[Mono-list] different filestream behavior of mono and .net

2a5gjx302@sneakemail.com 2a5gjx302@sneakemail.com
Sun, 29 Jun 2003 13:39:22


At 02:07 PM 16/06/2003 +0100, you wrote:
[snip]
>Nice to see ms following their own documentation:
>
>I quote from the .net 1.1 docs - from System.IO.FileStream.ctor()
>"FileShare.Read is the default for those FileStream constructors without
>a FileShare parameter." and from System.IO.FileMode "FileMode.Append can
>only be used in conjunction with FileAccess.Write.  Any attempt to read
>fails and throws an ArgumentException."
Just thought I'd point out that Microsoft is not violating their own
documentation. You are getting confused between FileShare.Read and
FileAccess.Read. Here is an additional line from the MSDN documentation
that clarifies the issue:

The constructor is given read/write access to the file, and it is opened
sharing Read access (that is, requests to open the file for writing by this
or another process will fail until the FileStream object has been closed,
but read attempts will succeed).

The first phrase in this line is relevent: the file is opened with
FileAccess.ReadWrite.

[snip]

Cheers,

Jonathan