System.IO.FileStream derives from System.IO.Stream Length property returns the size of a file in bytes: using System;
using System.IO;
class Prg {
static void Main() {
FileStream fs = new FileStream("Length.cs", FileMode.Open, FileAccess.Read);
Console.WriteLine($"Size of {fs.Name} is {fs.Length} bytes");
}
}
Length property in System.IO.FileInfo.