Interface ISerializable<TSelf>
Represents an object that supports serialization and deserialization.
Inherited Members
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
View SourceReadFromAsync<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. |
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. |