Table of Contents

Interface ISerializer

Namespace
Ecng.Serialization
Assembly
Ecng.Serialization.dll

Provides methods for serializing and deserializing objects.

public interface ISerializer
Extension Methods

Properties

FileExtension

Gets the file extension associated with the serialized format.

string FileExtension { get; }

Property Value

string

Methods

DeserializeAsync(Stream, CancellationToken)

Asynchronously deserializes an object graph from the provided stream.

ValueTask<object> DeserializeAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The stream from which the object is deserialized.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

ValueTask<object>

A ValueTask<TResult> representing the asynchronous operation and the deserialized object.

SerializeAsync(object, Stream, CancellationToken)

Asynchronously serializes the specified object graph into the provided stream.

ValueTask SerializeAsync(object graph, Stream stream, CancellationToken cancellationToken)

Parameters

graph object

The object graph to serialize.

stream Stream

The stream to which the object is serialized.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

ValueTask

A ValueTask representing the asynchronous operation.