FileInfo.OpenRead 方法使用哪个 FileShare 选项?
Which FileShare option is used with FileInfo.OpenRead method?
.NET Framework 文档说,当我使用 FileInfo.OpenRead
方法时,会创建一个只读的 FileStream
,但是内部使用了哪个 FileShare
选项?
打开文件后,文件被读取或写入锁定?
快速查看 reference source 发现它是
FileShare.Read
这个设置是documented到
allow[s] subsequent opening of the file for reading
This method returns a read-only FileStream object with the FileShare
mode set to Read.
.NET Framework 文档说,当我使用 FileInfo.OpenRead
方法时,会创建一个只读的 FileStream
,但是内部使用了哪个 FileShare
选项?
打开文件后,文件被读取或写入锁定?
快速查看 reference source 发现它是
FileShare.Read
这个设置是documented到
allow[s] subsequent opening of the file for reading
This method returns a read-only FileStream object with the FileShare mode set to Read.