System.IO.Pipes.PipeStream.ReadAsync C# (CSharp) Méthode

ReadAsync() public méthode

public ReadAsync ( byte buffer, int offset, int count, System cancellationToken ) : System.Threading.Tasks.Task
buffer byte
offset int
count int
cancellationToken System
Résultat System.Threading.Tasks.Task
        public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
        public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }

Same methods

PipeStream::ReadAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task

Usage Example

    static async Task<byte[]> ReadBytesAsync(PipeStream pipeStream, int length)
    {
        Assert.True(pipeStream.IsConnected);

        byte[] buffer = new byte[length];
        Assert.True(length > 0);

        int readSoFar = 0;

        while (readSoFar < length)
        {
            int len = await pipeStream.ReadAsync(buffer, readSoFar, length - readSoFar);
            if (len == 0) break;
            readSoFar += len;
        }

        return buffer;
    }
All Usage Examples Of System.IO.Pipes.PipeStream::ReadAsync