How to Get the File Size in C# ?

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