Beispiel #1
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            if (buffer is null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            void wrappedCallback(IAsyncResult result)
            {
                lastRead = SourceStream.EndRead(result);
                outStream.Write(buffer, offset, lastRead);
                callback?.Invoke(result);
            }

            return(SourceStream.BeginRead(buffer, offset, count, wrappedCallback, state));
        }