Create a file - Kosher to use Dispose
Yes I know I can use a using statement and that is the typical way to handle file creation. However I just want to create an empty file on disk and do nothing with it in code. Is it consider good practice to just call the Dispose method? Example.
File.Create(System.IO.Path.Combine(@"c:\tmp\example.txt")).Dispose();
as oppose to
using (FileStream s = File.Create(@"c:\tmp\example.txt")) { /* do nothing */ }
0 comments:
Post a Comment