How to Get the File Size in C# ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

If you need a way to get the size of a file in your C# program , you can use the Length property of the FileInfo class.

How to Get the File Size in C# ?

FileInfo.Length returns the length of the file in bytes.

var lengthOfFile = new System.IO.FileInfo(path).Length
%d bloggers like this: