Stream.EndWrite Method
Ends an asynchronous write operation.
[Visual Basic] Public Overridable Sub EndWrite( _ ByVal asyncResult As IAsyncResult _ ) [C#] public virtual void EndWrite( IAsyncResult asyncResult ); [C++] public: virtual void EndWrite( IAsyncResult* asyncResult ); [JScript] public function EndWrite( asyncResult : IAsyncResult );
Parameters
- asyncResult
- A reference to the outstanding asynchronous I/O request.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | asyncResult is a null reference (Nothing in Visual Basic). |
| ArgumentException | asyncResult did not originate from a BeginWrite method on the current stream. |
Remarks
For an example of creating a file and writing text to a file, see Writing Text to a File. For an example of reading text from a file, see Reading Text from a File. For an example of reading from and writing to a binary file, see Reading and Writing to a Newly Created Data File. For an example of asynchronous file I/O, see Asynchronous File I/O.
EndWrite must be called exactly once on every IAsyncResult from BeginWrite.
This method blocks until the I/O operation has completed. Errors that occur during an asynchronous write request, such as a disk failure during the I/O request, occur on the threadpool thread and become visible upon a call to EndWrite. Exceptions thrown by the threadpool thread will not be visible when calling EndWrite.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard
See Also
Stream Class | Stream Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File | Asynchronous File I/O