Show / Hide Table of Contents

Class MemoryTransferObject

Represents data transfer object holding the content of the predefined size in the memory.

Inheritance
object
Disposable
MemoryTransferObject
Implements
IDisposable
IDataTransferObject
Inherited Members
Disposable.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.CreateException()
Disposable.DisposedTask
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.TrySetDisposedException(TaskCompletionSource)
Disposable.DisposeAsyncCore()
Disposable.DisposeAsync()
Disposable.TryBeginDispose()
Disposable.Dispose()
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(IEnumerable<IAsyncDisposable>)
Disposable.Dispose<T>(ReadOnlySpan<T>)
Disposable.DisposeAsync(params IAsyncDisposable[])
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.IO
Assembly: DotNext.IO.dll
Syntax
public class MemoryTransferObject : Disposable, IDisposable, IDataTransferObject

Constructors

| Edit this page View Source

MemoryTransferObject(int, MemoryAllocator<byte>?)

Represents data transfer object holding the content of the predefined size in the memory.

Declaration
public MemoryTransferObject(int length, MemoryAllocator<byte>? allocator = null)
Parameters
Type Name Description
int length

The length, in bytes, of the content.

MemoryAllocator<byte> allocator

The memory allocator.

Properties

| Edit this page View Source

Content

Gets the content of this object.

Declaration
public Memory<byte> Content { get; }
Property Value
Type Description
Memory<byte>

Methods

| Edit this page View Source

Dispose(bool)

Releases managed and unmanaged resources associated with this object.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

true if called from Dispose(); false if called from finalizer ~Disposable().

Overrides
Disposable.Dispose(bool)
| Edit this page View Source

TransformAsync<TResult, TTransformation>(TTransformation, CancellationToken)

Converts data transfer object to another type.

Declaration
public ValueTask<TResult> TransformAsync<TResult, TTransformation>(TTransformation transformation, CancellationToken token = default) where TTransformation : IDataTransferObject.ITransformation<TResult>
Parameters
Type Name Description
TTransformation transformation

The parser instance.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The converted DTO content.

Type Parameters
Name Description
TResult

The type of result.

TTransformation

The type of parser.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

WriteToAsync<TWriter>(TWriter, CancellationToken)

Transforms this object to serialized form.

Declaration
public ValueTask WriteToAsync<TWriter>(TWriter writer, CancellationToken token) where TWriter : IAsyncBinaryWriter
Parameters
Type Name Description
TWriter writer

The binary writer.

CancellationToken token

The toke that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing state of asynchronous execution.

Type Parameters
Name Description
TWriter

The type of writer.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

Implements

IDisposable
IDataTransferObject

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
DataTransferObject.ToByteArrayAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.ToMemoryAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.TransformAsync<TResult, TObject>(TObject, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, IBufferWriter<byte>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, PipeWriter, long, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, int, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Memory<byte>, CancellationToken)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾