public ReadAsync ( Byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task |
||
buffer | Byte | |
offset | int | |
count | int | |
cancellationToken | CancellationToken | |
return | Task |
byte[] buffer = new byte[1024]; MemoryStream memoryStream = new MemoryStream(); // Write some data to the memory stream memoryStream.Write(buffer, 0, buffer.Length); // Set the position to the beginning of the stream memoryStream.Position = 0; // Read the contents of the memory stream asynchronously await memoryStream.ReadAsync(buffer, 0, buffer.Length);
byte[] buffer = new byte[1024]; MemoryStream memoryStream = new MemoryStream(); // Write some data to the memory stream memoryStream.Write(buffer, 0, buffer.Length); // Set the position to the beginning of the stream memoryStream.Position = 0; // Read a specific number of bytes from the memory stream asynchronously await memoryStream.ReadAsync(buffer, 0, 512);The System.IO namespace is part of the .NET Framework Class Library.
public ReadAsync ( Byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task |
||
buffer | Byte | |
offset | int | |
count | int | |
cancellationToken | CancellationToken | |
return | Task |