Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​IO.​FileStreamOptions

Assembly: System.Runtime

Inheritance: object → FileStreamOptions

Defines a variety of configuration options for <see cref="T:System.IO.FileStream" /> .

Properties

public FileAccess
Access
A bitwise combination of the enumeration values that determines how the file can be accessed by the <see cref="T:System.IO.FileStream" /> object. This also determines the values returned by the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the <see cref="T:System.IO.FileStream" /> object.
public int
BufferSize
The size of the buffer used by <see cref="T:System.IO.FileStream" /> for buffering. The default buffer size is 4096. 0 or 1 means that buffering should be disabled. Negative values are not allowed.
public FileMode
Mode
One of the enumeration values that determines how to open or create the file.
public FileOptions
Options
A bitwise combination of the enumeration values that specifies additional file options. The default value is <see cref="F:System.IO.FileOptions.None" /> , which indicates synchronous IO.
public long
PreallocationSize
The initial allocation size in bytes for the file. A positive value is effective only when a regular file is being created or overwritten ( <see cref="F:System.IO.FileMode.Create" /> or <see cref="F:System.IO.FileMode.CreateNew" /> ). Negative values are not allowed. In other cases (including the default 0 value), it's ignored. This value is a hint and is not a strong guarantee. It is not supported on Web Assembly (WASM) and FreeBSD (the value is ignored). For Windows, Linux and macOS we will try to preallocate the disk space to fill the requested allocation size. If that turns out to be impossible, the operation is going to throw an exception. The final file length (EOF) will be determined by the number of bytes written to the file.
public FileShare
Share
A bitwise combination of the enumeration values that determines how the file will be shared by processes. The default value is <see cref="F:System.IO.FileShare.Read" /> .
public Nullable`1
UnixCreateMode
Gets or sets the Unix file mode used when a new file is created.

Methods

public bool
Equals​(object obj)
Inherited from object
obj The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.