I want to build my own flat file database. Here is how I access the flat file database
Dim fs As New System.IO.FileStream("C:\MyDb.txt", IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim sr As New System.IO.StreamReader(fs)
Is there a limit imposed by .Net for the usage of System.IO.FileShare.Read, System.IO.FileShare.Write and System.IO.FileShare.ReadWrite when dealing with a file?
I mean is that .Net capable to support thousands of users using file stream and stream reader objects with System.IO.FileShare.Read to access a single file concurrently?
I don’t know the exact limit imposed by .NET/windows, so I have created a real test for you. I ran the following test code for few minutes and I found that up to 635908 counts of
system.io.fileshareusage, it still functional, i.e. you can still read the flat database file’s content.Here is the code (it is a winform application, .Net 4):