15 [__DynamicallyInvokable]
18 private struct ReadWriteParameters
27 private sealed
class ReadWriteTask :
Task<int>, ITaskCompletionAction
29 internal readonly
bool _isRead;
33 internal byte[] _buffer;
46 internal void ClearBeginState()
53 [SecuritySafeCritical]
54 public ReadWriteTask(
bool isRead, Func<object, int>
function,
object state,
Stream stream,
byte[] buffer,
int offset,
int count,
AsyncCallback callback)
57 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
67 AddCompletionAction(
this);
72 private static void InvokeAsyncCallback(
object completedTask)
74 ReadWriteTask readWriteTask = (ReadWriteTask)completedTask;
76 readWriteTask._callback =
null;
77 callback(readWriteTask);
80 [SecuritySafeCritical]
81 void ITaskCompletionAction.Invoke(
Task completingTask)
88 callback(completingTask);
103 private sealed
class NullStream :
Stream 107 public override bool CanRead =>
true;
109 public override bool CanWrite =>
true;
111 public override bool CanSeek =>
true;
113 public override long Length => 0
L;
126 internal NullStream()
130 protected override void Dispose(
bool disposing)
134 public override void Flush()
145 return Task.FromCancellation(cancellationToken);
153 __Error.ReadNotSupported();
155 return BlockingBeginRead(buffer, offset, count, callback, state);
160 if (asyncResult ==
null)
164 return BlockingEndRead(asyncResult);
172 __Error.WriteNotSupported();
174 return BlockingBeginWrite(buffer, offset, count, callback, state);
179 if (asyncResult ==
null)
183 BlockingEndWrite(asyncResult);
186 public override int Read([In] [Out]
byte[] buffer,
int offset,
int count)
207 public override void Write(
byte[] buffer,
int offset,
int count)
218 return Task.FromCancellation(cancellationToken);
221 public override void WriteByte(
byte value)
230 public override void SetLength(
long length)
235 internal sealed
class SynchronousAsyncResult :
IAsyncResult 237 private readonly
object _stateObject;
239 private readonly
bool _isWrite;
245 private bool _endXxxCalled;
247 private int _bytesRead;
249 public bool IsCompleted =>
true;
253 public object AsyncState => _stateObject;
255 public bool CompletedSynchronously =>
true;
257 internal SynchronousAsyncResult(
int bytesRead,
object asyncStateObject)
259 _bytesRead = bytesRead;
260 _stateObject = asyncStateObject;
263 internal SynchronousAsyncResult(
object asyncStateObject)
265 _stateObject = asyncStateObject;
269 internal SynchronousAsyncResult(
Exception ex,
object asyncStateObject,
bool isWrite)
272 _stateObject = asyncStateObject;
276 internal void ThrowIfError()
278 if (_exceptionInfo !=
null)
280 _exceptionInfo.
Throw();
286 SynchronousAsyncResult synchronousAsyncResult = asyncResult as SynchronousAsyncResult;
287 if (synchronousAsyncResult ==
null || synchronousAsyncResult._isWrite)
289 __Error.WrongAsyncResult();
291 if (synchronousAsyncResult._endXxxCalled)
293 __Error.EndReadCalledTwice();
295 synchronousAsyncResult._endXxxCalled =
true;
296 synchronousAsyncResult.ThrowIfError();
297 return synchronousAsyncResult._bytesRead;
302 SynchronousAsyncResult synchronousAsyncResult = asyncResult as SynchronousAsyncResult;
303 if (synchronousAsyncResult ==
null || !synchronousAsyncResult._isWrite)
305 __Error.WrongAsyncResult();
307 if (synchronousAsyncResult._endXxxCalled)
309 __Error.EndWriteCalledTwice();
311 synchronousAsyncResult._endXxxCalled =
true;
312 synchronousAsyncResult.ThrowIfError();
322 private bool? _overridesBeginRead;
325 private bool? _overridesBeginWrite;
327 public override bool CanRead => _stream.CanRead;
329 public override bool CanWrite => _stream.CanWrite;
331 public override bool CanSeek => _stream.CanSeek;
338 return _stream.CanTimeout;
342 public override long Length 348 return _stream.Length;
359 return _stream.Position;
366 _stream.Position = value;
376 return _stream.ReadTimeout;
380 _stream.ReadTimeout = value;
389 return _stream.WriteTimeout;
393 _stream.WriteTimeout = value;
397 internal SyncStream(
Stream stream)
406 public override void Close()
416 base.Dispose(disposing:
true);
421 protected override void Dispose(
bool disposing)
434 base.Dispose(disposing);
439 public override void Flush()
447 public override int Read([In] [Out]
byte[] bytes,
int offset,
int count)
451 return _stream.Read(bytes, offset, count);
459 return _stream.ReadByte();
463 private static bool OverridesBeginMethod(
Stream stream,
string methodName)
480 if (!_overridesBeginRead.HasValue)
482 _overridesBeginRead = OverridesBeginMethod(_stream,
"BeginRead");
486 return _overridesBeginRead.Value ? _stream.BeginRead(buffer, offset, count, callback, state) : _stream.BeginReadInternal(buffer, offset, count, callback, state, serializeAsynchronously:
true);
492 if (asyncResult ==
null)
498 return _stream.EndRead(asyncResult);
506 return _stream.Seek(offset, origin);
510 public override void SetLength(
long length)
514 _stream.SetLength(length);
518 public override void Write(
byte[] bytes,
int offset,
int count)
522 _stream.Write(bytes, offset, count);
530 _stream.WriteByte(b);
537 if (!_overridesBeginWrite.HasValue)
539 _overridesBeginWrite = OverridesBeginMethod(_stream,
"BeginWrite");
543 return _overridesBeginWrite.Value ? _stream.BeginWrite(buffer, offset, count, callback, state) : _stream.BeginWriteInternal(buffer, offset, count, callback, state, serializeAsynchronously:
true);
549 if (asyncResult ==
null)
555 _stream.EndWrite(asyncResult);
561 [__DynamicallyInvokable]
564 private const int _DefaultCopyBufferSize = 81920;
567 private ReadWriteTask _activeReadWriteTask;
575 [__DynamicallyInvokable]
578 [__DynamicallyInvokable]
585 [__DynamicallyInvokable]
588 [__DynamicallyInvokable]
595 [__DynamicallyInvokable]
598 [__DynamicallyInvokable]
608 [__DynamicallyInvokable]
611 [__DynamicallyInvokable]
619 [__DynamicallyInvokable]
620 public abstract long Length 622 [__DynamicallyInvokable]
631 [__DynamicallyInvokable]
634 [__DynamicallyInvokable]
636 [__DynamicallyInvokable]
644 [__DynamicallyInvokable]
647 [__DynamicallyInvokable]
652 [__DynamicallyInvokable]
663 [__DynamicallyInvokable]
666 [__DynamicallyInvokable]
671 [__DynamicallyInvokable]
678 internal SemaphoreSlim EnsureAsyncActiveSemaphoreInitialized()
691 [__DynamicallyInvokable]
692 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
709 [__DynamicallyInvokable]
710 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
728 [__DynamicallyInvokable]
729 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
732 if (destination ==
null)
756 return CopyToAsyncInternal(destination, bufferSize, cancellationToken);
761 byte[] buffer =
new byte[bufferSize];
763 while ((bytesRead = await
ReadAsync(buffer, 0, buffer.Length, cancellationToken).
ConfigureAwait(continueOnCapturedContext:
false)) != 0)
765 await destination.
WriteAsync(buffer, 0, bytesRead, cancellationToken).
ConfigureAwait(continueOnCapturedContext:
false);
777 [__DynamicallyInvokable]
780 if (destination ==
null)
800 InternalCopyTo(destination, 81920);
814 [__DynamicallyInvokable]
817 if (destination ==
null)
841 InternalCopyTo(destination, bufferSize);
844 private void InternalCopyTo(
Stream destination,
int bufferSize)
846 byte[] array =
new byte[bufferSize];
848 while ((count =
Read(array, 0, array.Length)) != 0)
850 destination.
Write(array, 0, count);
862 [__DynamicallyInvokable]
871 [__DynamicallyInvokable]
872 protected virtual void Dispose(
bool disposing)
878 [__DynamicallyInvokable]
879 public abstract void Flush();
885 [__DynamicallyInvokable]
886 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
897 [__DynamicallyInvokable]
898 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
901 return Task.
Factory.StartNew(delegate(
object state)
909 [Obsolete(
"CreateWaitHandle will be removed eventually. Please use \"new ManualResetEvent(false)\" instead.")]
926 [__DynamicallyInvokable]
927 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
930 return BeginReadInternal(buffer, offset, count, callback, state, serializeAsynchronously:
false);
933 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
934 internal IAsyncResult BeginReadInternal(
byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state,
bool serializeAsynchronously)
938 __Error.ReadNotSupported();
940 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
942 return BlockingBeginRead(buffer, offset, count, callback, state);
944 SemaphoreSlim semaphoreSlim = EnsureAsyncActiveSemaphoreInitialized();
946 if (serializeAsynchronously)
952 semaphoreSlim.
Wait();
954 ReadWriteTask readWriteTask =
new ReadWriteTask(isRead:
true, delegate
956 ReadWriteTask readWriteTask2 =
Task.InternalCurrent as ReadWriteTask;
957 int result = readWriteTask2._stream.Read(readWriteTask2._buffer, readWriteTask2._offset, readWriteTask2._count);
958 readWriteTask2.ClearBeginState();
960 }, state,
this, buffer, offset, count, callback);
963 RunReadWriteTaskWhenReady(task, readWriteTask);
967 RunReadWriteTask(readWriteTask);
969 return readWriteTask;
981 [__DynamicallyInvokable]
984 if (asyncResult ==
null)
988 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
990 return BlockingEndRead(asyncResult);
992 ReadWriteTask activeReadWriteTask = _activeReadWriteTask;
993 if (activeReadWriteTask ==
null)
997 if (activeReadWriteTask != asyncResult)
1001 if (!activeReadWriteTask._isRead)
1007 return activeReadWriteTask.GetAwaiter().GetResult();
1011 _activeReadWriteTask =
null;
1012 _asyncActiveSemaphore.Release();
1030 [__DynamicallyInvokable]
1031 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1052 [__DynamicallyInvokable]
1053 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1058 return BeginEndReadAsync(buffer, offset, count);
1060 return Task.FromCancellation<
int>(cancellationToken);
1063 private Task<int> BeginEndReadAsync(
byte[] buffer,
int offset,
int count)
1070 }, (
Stream stream, ReadWriteParameters args,
AsyncCallback callback,
object state) => stream.BeginRead(args.Buffer, args.Offset, args.Count, callback, state), (
Stream stream,
IAsyncResult asyncResult) => stream.EndRead(asyncResult));
1084 [__DynamicallyInvokable]
1085 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1088 return BeginWriteInternal(buffer, offset, count, callback, state, serializeAsynchronously:
false);
1091 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1092 internal IAsyncResult BeginWriteInternal(
byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state,
bool serializeAsynchronously)
1096 __Error.WriteNotSupported();
1098 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
1100 return BlockingBeginWrite(buffer, offset, count, callback, state);
1102 SemaphoreSlim semaphoreSlim = EnsureAsyncActiveSemaphoreInitialized();
1104 if (serializeAsynchronously)
1110 semaphoreSlim.
Wait();
1112 ReadWriteTask readWriteTask =
new ReadWriteTask(isRead:
false, delegate
1114 ReadWriteTask readWriteTask2 =
Task.InternalCurrent as ReadWriteTask;
1115 readWriteTask2._stream.Write(readWriteTask2._buffer, readWriteTask2._offset, readWriteTask2._count);
1116 readWriteTask2.ClearBeginState();
1118 }, state,
this, buffer, offset, count, callback);
1121 RunReadWriteTaskWhenReady(task, readWriteTask);
1125 RunReadWriteTask(readWriteTask);
1127 return readWriteTask;
1130 private void RunReadWriteTaskWhenReady(
Task asyncWaiter, ReadWriteTask readWriteTask)
1134 RunReadWriteTask(readWriteTask);
1140 Tuple<Stream, ReadWriteTask> tuple = (Tuple<Stream, ReadWriteTask>)state;
1141 tuple.Item1.RunReadWriteTask(tuple.Item2);
1146 private void RunReadWriteTask(ReadWriteTask readWriteTask)
1148 _activeReadWriteTask = readWriteTask;
1150 readWriteTask.ScheduleAndStart(needsProtection:
false);
1161 [__DynamicallyInvokable]
1164 if (asyncResult ==
null)
1168 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
1170 BlockingEndWrite(asyncResult);
1173 ReadWriteTask activeReadWriteTask = _activeReadWriteTask;
1174 if (activeReadWriteTask ==
null)
1178 if (activeReadWriteTask != asyncResult)
1182 if (activeReadWriteTask._isRead)
1188 activeReadWriteTask.GetAwaiter().GetResult();
1192 _activeReadWriteTask =
null;
1193 _asyncActiveSemaphore.Release();
1211 [__DynamicallyInvokable]
1212 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1233 [__DynamicallyInvokable]
1234 [HostProtection(
SecurityAction.LinkDemand, ExternalThreading =
true)]
1239 return BeginEndWriteAsync(buffer, offset, count);
1241 return Task.FromCancellation(cancellationToken);
1244 private Task BeginEndWriteAsync(
byte[] buffer,
int offset,
int count)
1251 }, (
Stream stream, ReadWriteParameters args,
AsyncCallback callback,
object state) => stream.BeginWrite(args.Buffer, args.Offset, args.Count, callback, state), delegate(
Stream stream,
IAsyncResult asyncResult)
1253 stream.EndWrite(asyncResult);
1254 return default(VoidTaskResult);
1265 [__DynamicallyInvokable]
1273 [__DynamicallyInvokable]
1274 public abstract void SetLength(
long value);
1289 [__DynamicallyInvokable]
1290 public abstract int Read([In] [Out]
byte[] buffer,
int offset,
int count);
1296 [__DynamicallyInvokable]
1299 byte[] array =
new byte[1];
1300 if (
Read(array, 0, 1) == 0)
1320 [__DynamicallyInvokable]
1321 public abstract void Write(
byte[] buffer,
int offset,
int count);
1328 [__DynamicallyInvokable]
1342 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true)]
1349 if (stream is SyncStream)
1353 return new SyncStream(stream);
1357 [Obsolete(
"Do not call or override this method.")]
1364 SynchronousAsyncResult synchronousAsyncResult;
1367 int bytesRead =
Read(buffer, offset, count);
1368 synchronousAsyncResult =
new SynchronousAsyncResult(bytesRead, state);
1370 catch (IOException ex)
1372 synchronousAsyncResult =
new SynchronousAsyncResult(ex, state, isWrite:
false);
1374 callback?.Invoke(synchronousAsyncResult);
1375 return synchronousAsyncResult;
1378 internal static int BlockingEndRead(IAsyncResult asyncResult)
1380 return SynchronousAsyncResult.EndRead(asyncResult);
1383 internal IAsyncResult BlockingBeginWrite(
byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state)
1385 SynchronousAsyncResult synchronousAsyncResult;
1388 Write(buffer, offset, count);
1389 synchronousAsyncResult =
new SynchronousAsyncResult(state);
1391 catch (IOException ex)
1393 synchronousAsyncResult =
new SynchronousAsyncResult(ex, state, isWrite:
true);
1395 callback?.Invoke(synchronousAsyncResult);
1396 return synchronousAsyncResult;
1399 internal static void BlockingEndWrite(IAsyncResult asyncResult)
1401 SynchronousAsyncResult.EndWrite(asyncResult);
1405 [__DynamicallyInvokable]
static new TaskFactory< TResult > Factory
Provides access to factory methods for creating and configuring T:System.Threading....
Represents a lightweight alternative to T:System.Threading.Semaphore that limits the number of thread...
abstract void Write(byte[] buffer, int offset, int count)
When overridden in a derived class, writes a sequence of bytes to the current stream and advances the...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
abstract int Read([In] [Out] byte[] buffer, int offset, int count)
When overridden in a derived class, reads a sequence of bytes from the current stream and advances th...
Propagates notification that operations should be canceled.
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Configures an awaiter used to await this T:System.Threading.Tasks.Task`1.
delegate void ContextCallback(object state)
Represents a method to be called within a new context.
Encapsulates operating system–specific objects that wait for exclusive access to shared resources.
virtual void Dispose(bool disposing)
Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed r...
virtual Task FlushAsync(CancellationToken cancellationToken)
Asynchronously clears all buffers for this stream, causes any buffered data to be written to the unde...
Stream()
Initializes a new instance of the T:System.IO.Stream class.
static void SuppressFinalize(object obj)
Requests that the common language runtime not call the finalizer for the specified object.
Discovers the attributes of a method and provides access to method metadata.
abstract bool CanSeek
When overridden in a derived class, gets a value indicating whether the current stream supports seeki...
void Throw()
Throws the exception that is represented by the current T:System.Runtime.ExceptionServices....
virtual int WriteTimeout
Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write befor...
Provides a mechanism for releasing unmanaged resources.To browse the .NET Framework source code for t...
Represents an object that handles the low-level work of queuing tasks onto threads.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
TaskContinuationOptions
Specifies the behavior for a task that is created by using the M:System.Threading....
The exception that is thrown when the value of an argument is outside the allowable range of values a...
abstract bool CanWrite
When overridden in a derived class, gets a value indicating whether the current stream supports writi...
delegate void AsyncCallback(IAsyncResult ar)
References a method to be called when a corresponding asynchronous operation completes.
virtual void WriteByte(byte value)
Writes a byte to the current position in the stream and advances the position within the stream by on...
bool IsCancellationRequested
Gets whether cancellation has been requested for this token.
Task< int > ReadAsync(byte[] buffer, int offset, int count)
Asynchronously reads a sequence of bytes from the current stream and advances the position within the...
abstract void SetLength(long value)
When overridden in a derived class, sets the length of the current stream.
SeekOrigin
Specifies the position in a stream to use for seeking.
TaskCreationOptions
Specifies flags that control optional behavior for the creation and execution of tasks.
virtual IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Begins an asynchronous read operation. (Consider using M:System.IO.Stream.ReadAsync(System....
static ExceptionDispatchInfo Capture(Exception source)
Creates an T:System.Runtime.ExceptionServices.ExceptionDispatchInfo object that represents the specif...
The exception that is thrown when an operation is performed on a disposed object.
Task CopyToAsync(Stream destination)
Asynchronously reads the bytes from the current stream and writes them to another stream.
abstract bool CanRead
When overridden in a derived class, gets a value indicating whether the current stream supports readi...
Represents an exception whose state is captured at a certain point in code.
static TaskScheduler Default
Gets the default T:System.Threading.Tasks.TaskScheduler instance that is provided by the ....
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
virtual void Close()
Closes the current stream and releases any resources (such as sockets and file handles) associated wi...
Represents the status of an asynchronous operation.
Manages the execution context for the current thread. This class cannot be inherited.
Task CopyToAsync(Stream destination, int bufferSize)
Asynchronously reads the bytes from the current stream and writes them to another stream,...
static readonly Stream Null
A Stream with no backing store.
Provides lazy initialization routines.
bool IsCompleted
Gets whether this T:System.Threading.Tasks.Task has completed.
virtual int ReadTimeout
Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before...
Task WaitAsync()
Asynchronously waits to enter the T:System.Threading.SemaphoreSlim.
Task FlushAsync()
Asynchronously clears all buffers for this stream and causes any buffered data to be written to the u...
virtual void ObjectInvariant()
Provides support for a T:System.Diagnostics.Contracts.Contract.
abstract void Flush()
When overridden in a derived class, clears all buffers for this stream and causes any buffered data t...
void CopyTo(Stream destination)
Reads the bytes from the current stream and writes them to another stream.
Notifies one or more waiting threads that an event has occurred. This class cannot be inherited.
void Wait()
Blocks the current thread until it can enter the T:System.Threading.SemaphoreSlim.
virtual int ReadByte()
Reads a byte from the stream and advances the position within the stream by one byte,...
static void Run(ExecutionContext executionContext, ContextCallback callback, object state)
Runs a method in a specified execution context on the current thread.
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
abstract long Seek(long offset, SeekOrigin origin)
When overridden in a derived class, sets the position within the current stream.
virtual bool CanTimeout
Gets a value that determines whether the current stream can time out.
static Task CompletedTask
Gets a task that has already completed successfully.
MethodImplOptions
Defines the details of how a method is implemented.
static CancellationToken None
Returns an empty T:System.Threading.CancellationToken value.
Controls the system garbage collector, a service that automatically reclaims unused memory.
virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Begins an asynchronous write operation. (Consider using M:System.IO.Stream.WriteAsync(System....
static ExecutionContext Capture()
Captures the execution context from the current thread.
The exception that is thrown when one of the arguments provided to a method is not valid.
abstract long Length
When overridden in a derived class, gets the length in bytes of the stream.
virtual WaitHandle CreateWaitHandle()
Allocates a T:System.Threading.WaitHandle object.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Creates or manipulates threads other than its own, which might be harmful to the host.
virtual Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Asynchronously reads a sequence of bytes from the current stream, advances the position within the st...
static Stream Synchronized(Stream stream)
Creates a thread-safe (synchronized) wrapper around the specified T:System.IO.Stream object.
Specifies that the class can be serialized.
abstract long Position
When overridden in a derived class, gets or sets the position within the current stream.
void Dispose()
Releases all resources used by the T:System.IO.Stream.
Task WriteAsync(byte[] buffer, int offset, int count)
Asynchronously writes a sequence of bytes to the current stream and advances the current position wit...
The exception that is thrown when a method call is invalid for the object's current state.
Manipulates arrays of primitive types.
Task ContinueWith(Action< Task< TResult >> continuationAction)
Creates a continuation that executes asynchronously when the target task completes.
string Name
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
virtual int EndRead(IAsyncResult asyncResult)
Waits for the pending asynchronous read to complete. (Consider using M:System.IO.Stream....
virtual Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Asynchronously writes a sequence of bytes to the current stream, advances the current position within...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
Provides support for creating and scheduling T:System.Threading.Tasks.Task`1 objects.
virtual Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
Asynchronously reads the bytes from the current stream and writes them to another stream,...
virtual void EndWrite(IAsyncResult asyncResult)
Ends an asynchronous write operation. (Consider using M:System.IO.Stream.WriteAsync(System....
void CopyTo(Stream destination, int bufferSize)
Reads the bytes from the current stream and writes them to another stream, using a specified buffer s...
Represents an asynchronous operation that can return a value.
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....
Enables access to objects across application domain boundaries in applications that support remoting.