FileShare 枚举与其他 FileStream 构造函数枚举之间的关系是什么

What is relationship between FileShare enum and other FileStream constructors enums

我搜索了问题"What is default value of FileShare enum"的答案并找到了答案IO.FileStream : FileShare default ?. In this answer also is link to MSDN FileStream Constructor (String, FileMode)。我从这个答案中了解到,在不同的 FileStream 构造函数中,FileShare 枚举默认值也可能不同,具体取决于其他这些构造函数参数。可能有人知道 FileShare 枚举与其他 FileStream 构造函数枚举之间关系的逻辑?

道理很简单。如果您提供 FileShare 值,它将使用该值,否则它将使用 FileShare.Read.

文档说:

"FileShare.Read is the default for those FileStream constructors without a FileShare parameter."

这意味着所有没有 FileShare 参数的构造函数都使用 FileShare.Read,所有具有 FileShare 参数的构造函数都将使用该参数值。