Class Serializable
Extends ISerializable<TSelf> implementing types.
Inherited Members
Namespace: DotNext.Runtime.Serialization
Assembly: DotNext.IO.dll
Syntax
public static class Serializable
Methods
View SourceReadFromAsync<T>(PipeReader, CancellationToken)
Deserializes the object from the pipe.
Declaration
public static ValueTask<T> ReadFromAsync<T>(PipeReader reader, CancellationToken token = default) where T : notnull, ISerializable<T>
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<T> | Deserialized object. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | The operation has been canceled. |
ReadFromAsync<T>(Stream, int, CancellationToken)
Deserializes the object from the stream.
Declaration
public static ValueTask<T> ReadFromAsync<T>(Stream input, int bufferSize = 128, CancellationToken token = default) where T : notnull, ISerializable<T>
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<T> | Deserialized object. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | The operation has been canceled. |
ReadFromAsync<T>(Stream, Memory<byte>, CancellationToken)
Deserializes the object from the stream.
Declaration
public static ValueTask<T> ReadFromAsync<T>(Stream input, Memory<byte> buffer, CancellationToken token = default) where T : ISerializable<T>
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<T> | Deserialized object. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | The operation has been canceled. |