i am making application in C#. Here i want to find out the number of bytes in particular file. Here i am using code as
using(FileStream fs=new FileStream(filename,FileMode.Open,FileAccess.Read))
{
//Here i want to find the number of Bytes.
//Some more code.
}
Please help me.Thanks in advance.
You can use the FileInfo
class to get its length in bytes (as an Int64
):
new FileInfo(filename).Length;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With