HS Banner
Back
Delete a File with C#

Author: Admin 03/13/2023
Language: C#
Tags: cs delete file


Description:

This is how to delete a file and check whether it exists.

Article:

This is very ease in C# using the File class.

Use System.IO

if(File.Exists(@"C:\MyFile.txt"))
  {
    File.Delete(@"C:\MyFile.txt");
  }


Back
Comments
Add Comment
There are no comments yet.