Table of Contents

Interface IMessageSerializer

Namespace
AnyProtocol.Serializer.Abstraction
Assembly
AnyProtocol.Serializer.Abstraction.dll

Defines operations for message.

public interface IMessageSerializer : IDisposable
Inherited Members

Methods

Deserialize(Type, ReadOnlyMemory<byte>)

Deserializes a message value from a transport payload.

object? Deserialize(Type type, ReadOnlyMemory<byte> bytes)

Parameters

type Type

The runtime type to resolve.

bytes ReadOnlyMemory<byte>

The bytes.

Returns

object

The value produced by the operation.

DeserializeAsync(Type, ReadOnlyMemory<byte>, CancellationToken)

Deserializes a message value from a transport payload.

ValueTask<object?> DeserializeAsync(Type type, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)

Parameters

type Type

The runtime type to resolve.

bytes ReadOnlyMemory<byte>

The bytes.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask<object>

A task whose result contains the value produced by the operation.

DeserializeAsync<T>(ReadOnlyMemory<byte>, CancellationToken)

Deserializes a message value from a transport payload.

ValueTask<T?> DeserializeAsync<T>(ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)

Parameters

bytes ReadOnlyMemory<byte>

The bytes.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask<T>

A task whose result contains the value produced by the operation.

Type Parameters

T

The message type to deserialize.

Deserialize<T>(ReadOnlyMemory<byte>)

Deserializes a message value from a transport payload.

T? Deserialize<T>(ReadOnlyMemory<byte> bytes)

Parameters

bytes ReadOnlyMemory<byte>

The bytes.

Returns

T

The value produced by the operation.

Type Parameters

T

The message type to deserialize.

Serialize(Type, object)

Serializes a message value into a transport payload.

ReadOnlyMemory<byte> Serialize(Type type, object data)

Parameters

type Type

The runtime type to resolve.

data object

The data.

Returns

ReadOnlyMemory<byte>

The value produced by the operation.

SerializeAsync(Type, object, CancellationToken)

Serializes a message value into a transport payload.

ValueTask<ReadOnlyMemory<byte>> SerializeAsync(Type type, object data, CancellationToken cancellationToken = default)

Parameters

type Type

The runtime type to resolve.

data object

The data.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask<ReadOnlyMemory<byte>>

A task whose result contains the value produced by the operation.

SerializeAsync<T>(T, CancellationToken)

Serializes a message value into a transport payload.

ValueTask<ReadOnlyMemory<byte>> SerializeAsync<T>(T data, CancellationToken cancellationToken = default)

Parameters

data T

The data.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask<ReadOnlyMemory<byte>>

A task whose result contains the value produced by the operation.

Type Parameters

T

The message type to serialize.

Serialize<T>(T)

Serializes a message value into a transport payload.

ReadOnlyMemory<byte> Serialize<T>(T data)

Parameters

data T

The data.

Returns

ReadOnlyMemory<byte>

The value produced by the operation.

Type Parameters

T

The message type to serialize.