谁能告诉我 OpenRead 方法读取文件的权限和文件共享是什么。
我正在尝试这段代码,
FileStream stream = File.OpenRead(FileName);
但是被建议使用这个代码,
var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
所以我的问题是,如果我不提供其他参数,File.OpenRead() 默认使用什么。
我不能只更改生产服务器上的代码。
最佳答案
[public static FileStream OpenRead(string path)] is equivalent to the FileStream(String, FileMode, FileAccess, FileShare) constructor overload with a FileMode value of Open, a FileAccess value of Read and a FileShare value of Read.
关于c# - FileStream 流 = File.OpenRead(文件名);,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19049542/