public virtual void EndWrite (IAsyncResult asyncResult)
{
if (asyncResult == null)
throw new ArgumentNullException ("asyncResult");
StreamAsyncResult result = asyncResult as StreamAsyncResult;
if (result == null || result.NBytes != -1)
throw new ArgumentException ("Invalid IAsyncResult", "asyncResult");
if (result.Done)
throw new InvalidOperationException ("EndWrite already called.");
result.Done = true;
if (result.Exception != null)
throw result.Exception;
}
}