Table of Contents

AsyncEncodingOptions Class

Definition

Namespace
Cuemon.Text
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Text/AsyncEncodingOptions.cs

Specifies options that is related to the Encoding class.

public sealed class AsyncEncodingOptions : EncodingOptions, IEncodingOptions, IParameterObject, IAsyncOptions
Inheritance
AsyncEncodingOptions
Implements
Inherited Members

Examples

The following example demonstrates how to configure AsyncEncodingOptions with a cancellation token for use in asynchronous encoding operations.

using System.Threading.Tasks;
using System.Text;
using System.Threading;
using Cuemon.Text;

namespace MyApp.Examples;

public class AsyncEncodingOptionsExample
{
    public void Demonstrate()
    {
        using var cts = new CancellationTokenSource();
        var options = new AsyncEncodingOptions
        {
            Encoding = Encoding.UTF8,
            Preamble = PreambleSequence.Remove,
            CancellationToken = cts.Token
        };

        // The options can be passed to async encoding methods
        // that accept AsyncEncodingOptions. If cancellation is
        // requested, the operation will be cancelled gracefully.

}
}

Constructors

Name Description
AsyncEncodingOptions()

Initializes a new instance of the EncodingOptions class.

Properties

Name Description
CancellationToken

Gets or sets the cancellation token of an asynchronous operations.