Delete a file : File : File Stream C# Source Code


Custom Search

C# Source Code » File Stream » File »

 

Delete a file








    


using System;
using System.IO;

class MainClass {
    static void Main() {
        string tempFile = Path.GetTempFileName();

        Console.WriteLine("Using " + tempFile);

        using (FileStream fs = new FileStream(tempFile, FileMode.Open)) {
            // (Write some data.)
        }

        // Now delete the file.
        File.Delete(tempFile);

    }
}


       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» File