C# 如何查找文件中的字节数?
我在申请C#。在这里,我想找出特定文件中的字节数。这里我使用代码作为C# 如何查找文件中的字节数?,c#,file,size,byte,C#,File,Size,Byte,我在申请C#。在这里,我想找出特定文件中的字节数。这里我使用代码作为 using(FileStream fs=new FileStream(filename,FileMode.Open,FileAccess.Read)) { //Here i want to find the number of Bytes. //Some more code. } 请帮助我。提前谢谢。您可以使用该类获取其字节数(作为Int64): 使用属性 获取流的长度(以字节为单位) new FileInf
using(FileStream fs=new FileStream(filename,FileMode.Open,FileAccess.Read))
{
//Here i want to find the number of Bytes.
//Some more code.
}
请帮助我。提前谢谢。您可以使用该类获取其字节数(作为Int64
):
使用属性
获取流的长度(以字节为单位)
new FileInfo(filename).Length;