Method OpenStreamAsync
OpenStreamAsync(FileMode, FileAccess, FileShare, int, FileOptions)
Opens an asynchronous file stream to a new or existing file (the Asynchronous option is always appended).
Declaration
Task<FileStream> OpenStreamAsync(FileMode mode = FileMode.Open, FileAccess access = FileAccess.ReadWrite, FileShare share = FileShare.None, int bufferSize = 4096, FileOptions options = FileOptions.None)
Parameters
Type | Name | Description |
---|---|---|
FileMode | mode | A FileMode constant specifying the mode (for example, Open or Append) in which to open the file. |
FileAccess | access | A FileAccess constant specifying whether to open the file with |
FileShare | share | A FileShare constant specifying the type of access other |
int | bufferSize | A positive value indicating the buffer size. |
FileOptions | options | Additional file options. |
Returns
Type | Description |
---|---|
Task<FileStream> | A task with a new FileStream to the opened file. |
Remarks
Note that the underlying operating system might not support asynchronous I/O, so the handle might be opened synchronously depending on the platform.