There are times when you want to create an unique temporary file in C# to deal with the storage of the data. In this case , you can use the Guid Name to get the unique name.
How to Create a Unique temporary file in C# ?
using System; using System.Collections.Generic; using System.Linq; namespace ACCode { class Program { static void Main(string[] args) { string temporaryFile = System.IO.Path.GetTempPath() + Guid.NewGuid()+ ".txt"; Console.WriteLine(temporaryFile); Console.ReadLine(); } } }
Leave a Reply