C# program to delete a text file

Program

using System;
using System.IO;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main()
		{
			//method to delete file
			File.Delete("123.TXT");
			//confirmation message
			Console.WriteLine("File deleted successfully");
		}
	}
}

Output

File deleted successfully

Leave a Comment

error: Alert: Content is protected!!