public override int EndRead(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } AsyncResult asyncResult2 = asyncResult as AsyncResult; if (asyncResult2 == null) { throw new ArgumentException("Invalid IAsyncResult", "asyncResult"); } MonoSyncFileStream.ReadDelegate readDelegate = asyncResult2.AsyncDelegate as MonoSyncFileStream.ReadDelegate; if (readDelegate == null) { throw new ArgumentException("Invalid IAsyncResult", "asyncResult"); } return(readDelegate.EndInvoke(asyncResult)); }
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback cback, object state) { if (!this.CanRead) { throw new NotSupportedException("This stream does not support reading"); } 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.ReadDelegate readDelegate = new MonoSyncFileStream.ReadDelegate(this.Read); return(readDelegate.BeginInvoke(buffer, offset, count, cback, state)); }