Show / Hide Table of Contents

Interface ISerializable<TSelf>

Represents an object that supports serialization and deserialization.

Inherited Members
IDataTransferObject.Empty
IDataTransferObject.IsReusable
IDataTransferObject.Length
IDataTransferObject.WriteToAsync<TWriter>(TWriter, CancellationToken)
IDataTransferObject.TransformAsync<TResult, TTransformation>(Stream, TTransformation, bool, Memory<byte>, CancellationToken)
IDataTransferObject.TransformAsync<TResult, TTransformation>(Stream, TTransformation, bool, MemoryAllocator<byte>, CancellationToken)
IDataTransferObject.TransformAsync<TResult, TTransformation>(Stream, TTransformation, bool, CancellationToken)
IDataTransferObject.TransformAsync<TResult, TTransformation>(PipeReader, TTransformation, CancellationToken)
IDataTransferObject.TransformAsync<TResult, TTransformation>(TTransformation, CancellationToken)
IDataTransferObject.TryGetMemory(out ReadOnlyMemory<byte>)
Namespace: DotNext.Runtime.Serialization
Assembly: DotNext.IO.dll
Syntax
public interface ISerializable<TSelf> : IDataTransferObject where TSelf : ISerializable<TSelf>
Type Parameters
Name Description
TSelf

The implementing type.

Methods

| Edit this page View Source

ReadFromAsync(PipeReader, CancellationToken)

Deserializes the object from the pipe.

Declaration
public static ValueTask<TSelf> ReadFromAsync(PipeReader reader, CancellationToken token = default)
Parameters
Type Name Description
PipeReader reader

The pipe reader.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TSelf>

Deserialized object.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

ReadFromAsync(Stream, int, CancellationToken)

Deserializes the object from the stream.

Declaration
public static ValueTask<TSelf> ReadFromAsync(Stream input, int bufferSize = 128, CancellationToken token = default)
Parameters
Type Name Description
Stream input

The stream containing serialized data.

int bufferSize

The size of the buffer to be used for reading from the stream.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TSelf>

Deserialized object.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

ReadFromAsync(Stream, Memory<byte>, CancellationToken)

Deserializes the object from the stream.

Declaration
public static ValueTask<TSelf> ReadFromAsync(Stream input, Memory<byte> buffer, CancellationToken token = default)
Parameters
Type Name Description
Stream input

The stream containing serialized data.

Memory<byte> buffer

The buffer to be used for reading from the stream.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TSelf>

Deserialized object.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

ReadFromAsync<TReader>(TReader, CancellationToken)

Decodes the object of type TSelf from its binary representation.

Declaration
public static abstract ValueTask<TSelf> ReadFromAsync<TReader>(TReader reader, CancellationToken token) where TReader : IAsyncBinaryReader
Parameters
Type Name Description
TReader reader

The reader.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TSelf>

The decoded object.

Type Parameters
Name Description
TReader

The type of the reader.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

TransformAsync<TInput>(TInput, CancellationToken)

Transforms one object into another object.

Declaration
public static ValueTask<TSelf> TransformAsync<TInput>(TInput input, CancellationToken token = default) where TInput : IDataTransferObject
Parameters
Type Name Description
TInput input

The object to transform.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TSelf>

Deserialized object.

Type Parameters
Name Description
TInput

The type of the object to transform.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾