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
-
ISerializer<T>
- 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
Methods
DeserializeAsync(Stream, CancellationToken)
Deserializes an object graph from the provided stream asynchronously.
public abstract ValueTask<T> DeserializeAsync(Stream stream, CancellationToken cancellationToken)
Parameters
stream
StreamThe stream from which the object graph is deserialized.
cancellationToken
CancellationTokenA 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
TThe object graph to serialize.
stream
StreamThe stream to which the graph is serialized.
cancellationToken
CancellationTokenA token that can be used to cancel the serialization operation.
Returns
- ValueTask
A task representing the asynchronous serialize operation.