Home > Code > File Handling > To delete an existing file using C#.NET

To delete an existing file using C#.NET

by Thamil   on Dec 19, 2011   Category: File Handling   |  Views: 2421    |  Points: 25   |  Gold 



Below sample c# code will help you to delete the existing file in the specific place.


using System;
using System.IO;

private void DeleteFile()
{
string FilePath = @"C:\test.xls";
if (File.Exists(FilePath))
{
File.Delete(FilePath);
}
}





Post Code  |  Code Snippet Home

Recent Posts

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts