This is pretty straightforward using the File class.
if(File.Exists(@"C:est.txt"))
{
File.Delete(@"C:est.txt");
}
As
Chris pointed out in the comments, you don't actually need to do the
File.Exists
check since
File.Delete
doesn't throw an exception if the file doesn't exist, although if you're using absolute paths you will need the check to make sure the entire file path is valid.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…