Table of Contents

Class Serializer<T>

Namespace
Ecng.Serialization
Assembly
Ecng.Serialization.dll

Provides an abstract base class for type-specific serializers.

public abstract class Serializer<T> : ISerializer<T>, ISerializer

Type Parameters

T

The type of the graph to serialize and deserialize.

Inheritance
Serializer<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

Serializer()

protected Serializer()

Properties

FileExtension

Gets the file extension associated with this serializer.

public abstract string FileExtension { get; }

Property Value

string

Methods

DeserializeAsync(Stream, CancellationToken)

Deserializes an object graph from the provided stream asynchronously.

public abstract ValueTask<T> DeserializeAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The stream from which the object graph is deserialized.

cancellationToken CancellationToken

A token that can be used to cancel the deserialization operation.

Returns

ValueTask<T>

A task that represents the asynchronous deserialize operation. The task result contains the deserialized object graph.

SerializeAsync(T, Stream, CancellationToken)

Serializes the specified object graph to the provided stream asynchronously.

public abstract ValueTask SerializeAsync(T graph, Stream stream, CancellationToken cancellationToken)

Parameters

graph T

The object graph to serialize.

stream Stream

The stream to which the graph is serialized.

cancellationToken CancellationToken

A token that can be used to cancel the serialization operation.

Returns

ValueTask

A task representing the asynchronous serialize operation.