FileStream.BeginWrite Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Begins an asynchronous write.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

Public Overrides Function BeginWrite ( _
    array As Byte(), _
    offset As Integer, _
    numBytes As Integer, _
    userCallback As AsyncCallback, _
    stateObject As Object _
) As IAsyncResult
public override IAsyncResult BeginWrite(
    byte[] array,
    int offset,
    int numBytes,
    AsyncCallback userCallback,
    Object stateObject
)

Parameters

  • array
    Type: array<System..::.Byte>[]()[]
    The buffer containing data to write to the current stream.
  • offset
    Type: System..::.Int32
    The zero-based byte offset in array at which to begin copying bytes to the current stream.
  • stateObject
    Type: System..::.Object
    A user-provided object that distinguishes this particular asynchronous write request from other requests.

Return Value

Type: System..::.IAsyncResult
An IAsyncResult that references the asynchronous write.

Exceptions

Exception Condition
ArgumentException

array length minus offset is less than numBytes.

ArgumentNullException

array is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

offset or numBytes is negative.

NotSupportedException

The stream does not support writing.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurs.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

FileStream Class

System.IO Namespace