Various extension methods for IDataTransferObject.
InheritanceDataTransferObject
Namespace: DotNext.IO Assembly: DotNext.IO.dll Syntaxpublic static class DataTransferObject
Methods | Edit this page View Source ToByteArrayAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)
Converts DTO to an array of bytes.
Declarationpublic static ValueTask<byte[]> ToByteArrayAsync<TObject>(this TObject dto, MemoryAllocator<byte>? allocator = null, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Data transfer object to read from.
MemoryAllocator<byte> allocatorThe memory allocator.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source ToMemoryAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)Converts DTO to a block of memory.
Declarationpublic static ValueTask<MemoryOwner<byte>> ToMemoryAsync<TObject>(this TObject dto, MemoryAllocator<byte>? allocator = null, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Data transfer object to read from.
MemoryAllocator<byte> allocatorThe memory allocator.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source ToStringAsync<TObject>(TObject, Encoding, MemoryAllocator<byte>?, CancellationToken)Converts DTO content to string.
Declarationpublic static ValueTask<string> ToStringAsync<TObject>(this TObject dto, Encoding encoding, MemoryAllocator<byte>? allocator = null, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Data transfer object to read from.
Encoding encodingThe encoding used to decode stored string.
MemoryAllocator<byte> allocatorThe memory allocator.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source TransformAsync<TResult, TObject>(TObject, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>>, CancellationToken)Converts data transfer object to another type.
Declarationpublic static ValueTask<TResult> TransformAsync<TResult, TObject>(this TObject dto, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>> transformation, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Returns Type Description ValueTask<TResult>
The converted DTO content.
Type Parameters Name Description TResultThe type of result.
TObjectThe type of the data transfer object.
Exceptions | Edit this page View Source WriteToAsync<TObject>(TObject, IBufferWriter<byte>, CancellationToken)Copies the object content to the specified buffer.
Declarationpublic static ValueTask WriteToAsync<TObject>(this TObject dto, IBufferWriter<byte> writer, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Transfer data object to transform.
IBufferWriter<byte> writerThe buffer writer.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source WriteToAsync<TObject>(TObject, PipeWriter, long, CancellationToken)Copies the object content to the specified pipe writer.
Declarationpublic static ValueTask WriteToAsync<TObject>(this TObject dto, PipeWriter output, long bufferSize = 0, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Transfer data object to transform.
PipeWriter outputThe pipe writer receiving object content.
long bufferSizeThe maximum numbers of bytes that can be buffered in the memory without flushing.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source WriteToAsync<TObject>(TObject, Stream, int, CancellationToken)Copies the object content to the specified stream.
Declarationpublic static ValueTask WriteToAsync<TObject>(this TObject dto, Stream output, int bufferSize = 1024, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Transfer data object to transform.
Stream outputThe output stream receiving object content.
int bufferSizeThe size of the buffer to be used for transformation.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Type Parameters Name Description TObjectThe type of data transfer object.
Exceptions | Edit this page View Source WriteToAsync<TObject>(TObject, Stream, Memory<byte>, CancellationToken)Copies the object content into the specified stream.
Declarationpublic static ValueTask WriteToAsync<TObject>(this TObject dto, Stream output, Memory<byte> buffer, CancellationToken token = default) where TObject : IDataTransferObject
Parameters Type Name Description TObject dto
Transfer data object to transform.
Stream outputThe output stream receiving object content.
Memory<byte> bufferThe buffer to be used for transformation.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Type Parameters Name Description TObjectThe type of data transfer object.
ExceptionsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4