Deleting our flat files

Next, we create a function that allows us to delete flat files. Add this function to your script:

void DeleteFile(string file = "")
{
  File.Delete(sDirectory + file);
}

To delete a file, we use the Delete function within the File class. Before we delete the file, we make sure that it actually exists using the Exists function within the File class. The file that we are deleting is the one that is set to our directory and filename variables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.134.151