public override void EndWrite(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } AsyncResult asyncResult2 = asyncResult as AsyncResult; if (asyncResult2 == null) { throw new ArgumentException("Invalid IAsyncResult", "asyncResult"); } MonoSyncFileStream.WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as MonoSyncFileStream.WriteDelegate; if (writeDelegate == null) { throw new ArgumentException("Invalid IAsyncResult", "asyncResult"); } writeDelegate.EndInvoke(asyncResult); }
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback cback, object state) { if (!this.CanWrite) { throw new NotSupportedException("This stream does not support writing"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Must be >= 0"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Must be >= 0"); } MonoSyncFileStream.WriteDelegate writeDelegate = new MonoSyncFileStream.WriteDelegate(this.Write); return(writeDelegate.BeginInvoke(buffer, offset, count, cback, state)); }