Method OpenAsyncHandle
OpenAsyncHandle(FileMode, FileAccess, FileShare, FileOptions, long)
Opens an asynchronous handle to a new or existing file, for use with the methods of RandomAccess (the Asynchronous option is always appended).
Declaration
SafeFileHandle OpenAsyncHandle(FileMode mode = FileMode.Open, FileAccess access = FileAccess.ReadWrite, FileShare share = FileShare.None, FileOptions options = FileOptions.None, long preallocationSize = 0)
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 handles have to this file. |
| FileOptions | options | Additional file options. |
| long | preallocationSize | The initial allocation size in bytes for the file. Must be at least zero. |
Returns
| Type | Description |
|---|---|
| SafeFileHandle | A new SafeFileHandle 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.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| ArgumentException | The combination of |