public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
if (offset < 0)
throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (numBytes < 0)
throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - offset < numBytes)
throw new ArgumentException(SR.Argument_InvalidOffLen);
if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
if (!IsAsync)
return base.BeginRead(array, offset, numBytes, callback, state);
else
return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
}