Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IsolatedStorageFileStream.BeginWrite Method

Begins an asynchronous write.

[Visual Basic]
Overrides Public Function BeginWrite( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal numBytes As Integer, _
   ByVal userCallback As AsyncCallback, _
   ByVal stateObject As Object _
) As IAsyncResult
public override IAsyncResult BeginWrite(
 byte[] buffer,
 int offset,
 int numBytes,
 AsyncCallback userCallback,
 object stateObject
public: IAsyncResult* BeginWrite(
 unsigned char buffer __gc[],
 int offset,
 int numBytes,
 AsyncCallback* userCallback,
 Object* stateObject
public override function BeginWrite(
   buffer : Byte[],
 offset : int,
 numBytes : int,
 userCallback : AsyncCallback,
 stateObject : Object
) : IAsyncResult;


The buffer to which to write data.
The byte offset in array at which to begin writing.
The maximum number of bytes to write.
The method to be called when the asynchronous write operation is completed. This parameter is optional.
The status of the asynchronous write.

Return Value

An IAsyncResult that represents the asynchronous write, which is possibly still pending. This IAsyncResult must be passed to this stream's EndWrite method to ensure that the write is complete, then frees resources appropriately. This can be done either by the same code that called BeginWrite or in a callback passed to BeginWrite.


Exception Type Condition
IOException An asynchronous write was attempted past the end of the file.


If a IsolatedStorageFileStream is writable, writing at the end of the stream expands the stream.

The current position in the stream is updated when you issue the asynchronous read or write, not when the I/O operation completes.

You must call EndWrite with the IAsyncResult that this method returns to find out how many bytes were written.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IsolatedStorageFileStream Class | IsolatedStorageFileStream Members | System.IO.IsolatedStorage Namespace

© 2018 Microsoft