How do I check if a file is empty in C#?
I need something like:
if (file is empty) { // do stuff } else { // do other stuff }
Use FileInfo.Length:
if( new FileInfo( "file" ).Length == 0 ) { // empty }
Check the Exists property to find out, if the file exists at all.
1.4m articles
1.4m replys
5 comments
57.0k users