Edit

Share via


FileStreamOptions Class

Definition

Defines a variety of configuration options for FileStream.

public ref class FileStreamOptions sealed
public sealed class FileStreamOptions
type FileStreamOptions = class
Public NotInheritable Class FileStreamOptions
Inheritance
FileStreamOptions

Constructors

FileStreamOptions()

Initializes a FileStreamOptions instance with default values.

Properties

Access

A bitwise combination of the enumeration values that determines how the file can be accessed by the FileStream object. This also determines the values returned by the CanRead and CanWrite properties of the FileStream object.

BufferSize

The size of the buffer used by FileStream for buffering. The default buffer size is 4096. 0 or 1 means that buffering should be disabled. Negative values are not allowed.

Mode

One of the enumeration values that determines how to open or create the file.

Options

A bitwise combination of the enumeration values that specifies additional file options. The default value is None, which indicates synchronous IO.

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 (Create or 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.

Share

A bitwise combination of the enumeration values that determines how the file will be shared by processes. The default value is Read.

UnixCreateMode

Gets or sets the Unix file mode used when a new file is created.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to