ComponentStreamReader Class
The readable end of a stream held by the host: the host reads the values that a component writes. Use it on the thread of the store (in the functions of the host, whose continuations run there).
public sealed class ComponentStreamReader : IDisposable- Implements
Properties
| Name | Description |
|---|---|
| ElementType | Gets the type of the elements, or null. |
| IsCompleted | Gets whether the writer dropped its end: no more values will be read. |
ElementType
ComponentStreams.csGets the type of the elements, or null.
public ComponentValueType? ElementType { get; }Property value
IsCompleted
ComponentStreams.csMethods
| Name | Description |
|---|---|
| Dispose() | Drops the readable end: the writer cannot write anymore. |
| ReadAsync(int, CancellationToken) | Reads up to maxCount values: returns when the writer writes values, or drops its end (an empty array). |
| ReadAsync(Memory<byte>, CancellationToken) | Reads bytes of a stream<u8>: returns the number of bytes read, 0 when the writer dropped its end. |
Dispose()
ComponentStreams.csDrops the readable end: the writer cannot write anymore.
public void Dispose()ReadAsync overloads
ReadAsync(int, CancellationToken)
ComponentStreams.csReads up to maxCount values: returns when the writer writes values, or drops its end (an empty array).
net10.0
public ValueTask<ComponentValue[]> ReadAsync(int maxCount, CancellationToken cancellationToken = default)net11.0
public ValueTask<ComponentValue[]> ReadAsync(int maxCount, CancellationToken cancellationToken = default)Parameters
maxCountintcancellationTokenCancellationToken
Returns
Exceptions
ObjectDisposedException- The reader is disposed.
ReadAsync(Memory<byte>, CancellationToken)
ComponentStreams.csReads bytes of a stream<u8>: returns the number of bytes read, 0 when the writer dropped its end.
net10.0
public ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)net11.0
public ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)