Languages
[Edit]
EN

C# / .NET - file delete

9 points
Created by:
Root-ssh
6407

In C# / .NET it is possible to delete file in following way.

1. File.Delete method example

using System.IO;

public static class Program
{
	public static void Main(string[] args)
	{
		string path = @"C:\path\to\file.txt";

		File.Delete(path);
	}
}

Result:

  1. File.Delete Method - Microsoft Docs
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.