FileShare Enum

Peter Volz 1,295 Reputation points


My case is

Using imp As New FileStream(LoadTextBox.Text, FileMode.Open, FileAccess.Read)

Using exp As New FileStream(SaveTextBox.Text, FileMode.Create, FileAccess.Write)


End Using

only above 2 constructures, anyhow, since I don't specify the FileShare Enum, what's the default behavior for each one? (.netfw 4.0)

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,390 questions
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,606 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 113K Reputation points

    According to documentation, “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)” [].

1 additional answer

Sort by: Most helpful
  1. Dewayne Basnett 1,361 Reputation points

    From the Remarks here, It says "FileShare.Read is the default for those FileStream constructors without a FileShare parameter."

    0 comments No comments