DotNext.IO by Roman Sakno

<PackageReference Include="DotNext.IO" Version="3.2.1" />

 IDataTransferObject

public interface IDataTransferObject
Represents structured data unit that can be transferred over wire.
public interface ITransformation<TResult>

Represents DTO transformation.

Gets empty data transfer object.

bool IsReusable { get; }

Indicates that the content of this object can be copied to the output stream or pipe multiple times.

long? Length { get; }

Gets length of the object payload, in bytes.

ValueTask<TResult> TransformAsync<TResult, TTransformation>(Stream input, TTransformation transformation, bool resetStream, Memory<byte> buffer, CancellationToken token) where TTransformation : ITransformation<TResult>

Decodes the stream.

ValueTask<TResult> TransformAsync<TResult, TTransformation>(Stream input, TTransformation transformation, bool resetStream, MemoryAllocator<byte> allocator, CancellationToken token) where TTransformation : ITransformation<TResult>

Decodes the stream.

ValueTask<TResult> TransformAsync<TResult, TTransformation>(Stream input, TTransformation transformation, bool resetStream, CancellationToken token) where TTransformation : ITransformation<TResult>

Decodes the stream.

ValueTask<TResult> TransformAsync<TResult, TTransformation>(PipeReader input, TTransformation transformation, CancellationToken token) where TTransformation : ITransformation<TResult>

Decodes the data using pipe reader.

ValueTask<TResult> TransformAsync<TResult, TTransformation>(TTransformation transformation, CancellationToken token = default) where TTransformation : ITransformation<TResult>

Converts data transfer object to another type.

bool TryGetMemory(out ReadOnlyMemory memory)

Attempts to retrieve contents of this object as a memory block synchronously.

ValueTask WriteToAsync<TWriter>(TWriter writer, CancellationToken token) where TWriter : IAsyncBinaryWriter

Transforms this object to serialized form.