Search code examples
c#.netsystem.io.fileinfo

Which FileShare option is used with FileInfo.OpenRead method?


On .NET Framework documentation says that when I use FileInfo.OpenRead method a read-only FileStream is created but, which FileShare option is internally used?

Once I've opened the file is read or write locked?


Solution

  • A quick look in reference source reveals that it is

    FileShare.Read
    

    This setting is documented to

    allow[s] subsequent opening of the file for reading