What\'s the simplest/canonical way to create an empty file in C#/.NET?
The simplest way I could find so far is:
System.IO.File.WriteAllLines(filename
System.IO.File.Create(@"C:\Temp.txt");
As others have pointed out, you should dispose of this object or wrap it in an empty using statement.
using (System.IO.File.Create(@"C:\Temp.txt"));