Path.GetTempFileName() : Path « System.IO « C# / C Sharp by API






Path.GetTempFileName()

  
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);

    }
}

   
    
  








Related examples in the same category

1.Path.GetFullPath(String fileName)
2.Path.GetRandomFileName()