Table of Contents

Class TomlSerializer

Namespace
RStein.TOML
Assembly
RStein.TOML.dll

Provides methods for serializing and deserializing TOML data.

public static class TomlSerializer
Inheritance
TomlSerializer
Inherited Members

Methods

DeserializeAsync(Stream, CancellationToken)

Asynchronously deserializes TOML content from a stream to a TomlTable.

public static Task<TomlTable> DeserializeAsync(Stream tomlStream, CancellationToken cancellationToken = default)

Parameters

tomlStream Stream

The stream containing TOML content to deserialize.

cancellationToken CancellationToken

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

Returns

Task<TomlTable>

A task that represents the asynchronous operation. The task result contains the deserialized TomlTable.

Exceptions

ArgumentNullException

Thrown when tomlStream is null.

TomlSerializerException

Thrown when the TOML content cannot be parsed.

OperationCanceledException

Thrown when the operation is canceled.

DeserializeAsync(string, TomlSettings?, CancellationToken)

Asynchronously deserializes a TOML string to a TomlTable using the specified settings.

public static Task<TomlTable> DeserializeAsync(string toml, TomlSettings? tomlSettings, CancellationToken cancellationToken = default)

Parameters

toml string

The TOML content to deserialize.

tomlSettings TomlSettings

The settings to use for deserialization. If null, default settings are used.

cancellationToken CancellationToken

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

Returns

Task<TomlTable>

A task that represents the asynchronous operation. The task result contains the deserialized TomlTable.

Exceptions

ArgumentNullException

Thrown when toml is null.

TomlSerializerException

Thrown when the TOML content cannot be parsed.

OperationCanceledException

Thrown when the operation is canceled.

DeserializeAsync(string, CancellationToken)

Asynchronously deserializes a TOML string to a TomlTable.

public static Task<TomlTable> DeserializeAsync(string toml, CancellationToken cancellationToken = default)

Parameters

toml string

The TOML content to deserialize.

cancellationToken CancellationToken

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

Returns

Task<TomlTable>

A task that represents the asynchronous operation. The task result contains the deserialized TomlTable.

Exceptions

ArgumentNullException

Thrown when toml is null.

TomlSerializerException

Thrown when the TOML content cannot be parsed.

OperationCanceledException

Thrown when the operation is canceled.

SerializeAsync(TomlToken, Stream, TomlSettings?, CancellationToken)

Asynchronously serializes a TomlToken to a stream in TOML format using the specified settings.

public static Task SerializeAsync(TomlToken tomlToken, Stream stream, TomlSettings? tomlSettings, CancellationToken cancellationToken)

Parameters

tomlToken TomlToken

The TOML token to serialize.

stream Stream

The stream to write the serialized TOML content to.

tomlSettings TomlSettings

The settings to use for serialization. If null, default settings are used.

cancellationToken CancellationToken

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

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ArgumentNullException

Thrown when tomlToken or stream is null.

TomlSerializerException

Thrown when the token cannot be serialized.

OperationCanceledException

Thrown when the operation is canceled.

SerializeAsync(TomlToken, Stream, CancellationToken)

Asynchronously serializes a TomlToken to a stream in TOML format.

public static Task SerializeAsync(TomlToken tomlToken, Stream stream, CancellationToken cancellationToken = default)

Parameters

tomlToken TomlToken

The TOML token to serialize.

stream Stream

The stream to write the serialized TOML content to.

cancellationToken CancellationToken

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

Returns

Task

A task that represents the asynchronous operation.

Exceptions

ArgumentNullException

Thrown when tomlToken or stream is null.

TomlSerializerException

Thrown when the token cannot be serialized.

OperationCanceledException

Thrown when the operation is canceled.

SerializeToStringAsync(TomlToken, TomlSettings?, CancellationToken)

Asynchronously serializes a TomlToken to a TOML string using the specified settings.

public static Task<string> SerializeToStringAsync(TomlToken tomlToken, TomlSettings? tomlSettings, CancellationToken cancellationToken)

Parameters

tomlToken TomlToken

The TOML token to serialize.

tomlSettings TomlSettings

The settings to use for serialization. If null, default settings are used.

cancellationToken CancellationToken

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

Returns

Task<string>

A task that represents the asynchronous operation. The task result contains the serialized TOML string.

Exceptions

ArgumentNullException

Thrown when tomlToken is null.

TomlSerializerException

Thrown when the token cannot be serialized.

OperationCanceledException

Thrown when the operation is canceled.

SerializeToStringAsync(TomlToken, CancellationToken)

Asynchronously serializes a TomlToken to a TOML string.

public static Task<string> SerializeToStringAsync(TomlToken tomlToken, CancellationToken cancellationToken = default)

Parameters

tomlToken TomlToken

The TOML token to serialize.

cancellationToken CancellationToken

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

Returns

Task<string>

A task that represents the asynchronous operation. The task result contains the serialized TOML string.

Exceptions

ArgumentNullException

Thrown when tomlToken is null.

TomlSerializerException

Thrown when the token cannot be serialized.

OperationCanceledException

Thrown when the operation is canceled.