string file = "C:\\Projects\\Notes\\file.txt"; // escape all backslashes
string file = @"C:\Projects\Notes\file.txt"; // or use a string literal
if( File.Exists( file ) )
// Proceed with file handling code...
MessageBox.Show("This file doesn't exist!");
long fileSize = new FileInfo( file ).Length;If the file doesn't exist, create it -optionally writing some content to it- but avoid using it for a few milliseconds. If needed, use a timer before reading from it.
Note: aside from Length, other useful attributes you can get the same way (without actually opening the file) include CreationTime, IsReadOnly, LastAccessTime and LastWriteTime.