static void Main(string[] args) { Program1 p = new Program1(); p.fileStream = new FileStream(@"d:\words.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); p.fileStream.SafeFileHandle.Dispose(); ReadKey(); }
static void Main(string[] args) { using (var p = new Program1()); ReadKey(); }