Class PipeReaderExtensions
Provides extension methods for PipeReader to decode streamed elements.
public static class PipeReaderExtensions
- Inheritance
-
PipeReaderExtensions
- Inherited Members
Methods
ToAsyncEnumerable<T>(PipeReader, SliceEncoding, DecodeFunc<T>, IProxy?, ISliceFeature?)
Creates an async enumerable over a pipe reader to decode variable size streamed elements.
public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this PipeReader reader, SliceEncoding encoding, DecodeFunc<T> decodeFunc, IProxy? sender = null, ISliceFeature? sliceFeature = null)
Parameters
reader
PipeReaderThe pipe reader.
encoding
SliceEncodingThe Slice encoding version.
decodeFunc
DecodeFunc<T>The function used to decode the streamed member.
sender
IProxyThe proxy that sent the request, if applicable.
sliceFeature
ISliceFeatureThe slice feature to customize the decoding.
Returns
- IAsyncEnumerable<T>
The async enumerable to decode and return the streamed members.
Type Parameters
T
The stream element type.
Remarks
The reader ownership is transferred to the returned async enumerable. The caller should no longer use the reader after this call.
ToAsyncEnumerable<T>(PipeReader, SliceEncoding, DecodeFunc<T>, int, ISliceFeature?)
Creates an async enumerable over a pipe reader to decode streamed elements.
public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this PipeReader reader, SliceEncoding encoding, DecodeFunc<T> decodeFunc, int elementSize, ISliceFeature? sliceFeature = null)
Parameters
reader
PipeReaderThe pipe reader.
encoding
SliceEncodingThe Slice encoding version.
decodeFunc
DecodeFunc<T>The function used to decode the streamed member.
elementSize
intThe size in bytes of one element.
sliceFeature
ISliceFeatureThe Slice feature to customize the decoding.
Returns
- IAsyncEnumerable<T>
The async enumerable to decode and return the streamed elements.
Type Parameters
T
The type of the element being decoded.
Remarks
The reader ownership is transferred to the returned async enumerable. The caller should no longer use the reader after this call.
Exceptions
- ArgumentException
Thrown if
elementSize
is equal of inferior to0
.