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

NameDescription
ElementTypeGets the type of the elements, or null.
IsCompletedGets whether the writer dropped its end: no more values will be read.

Gets the type of the elements, or null.

public ComponentValueType? ElementType { get; }

Property value

ComponentValueType?

Gets whether the writer dropped its end: no more values will be read.

public bool IsCompleted { get; }

Property value

bool

Methods

NameDescription
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.

Drops the readable end: the writer cannot write anymore.

public void Dispose()

ReadAsync overloads

ReadAsync(int, CancellationToken)

ComponentStreams.cs

Reads 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
maxCount int
cancellationToken CancellationToken
Returns

ValueTask<ComponentValue[]>

Exceptions
ObjectDisposedException
The reader is disposed.

ReadAsync(Memory<byte>, CancellationToken)

ComponentStreams.cs

Reads 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)
Parameters
destination Memory<byte>
cancellationToken CancellationToken
Returns

ValueTask<int>