Table of Contents

Class AsyncEncodingOptions

Namespace
Cuemon.Text
Assembly
Cuemon.Core.dll

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

AsyncEncodingOptions()

Initializes a new instance of the EncodingOptions class.

public AsyncEncodingOptions()

Remarks

The following table shows the initial property values for an instance of EncodingOptions.

PropertyInitial Value
CancellationTokendefault

Properties

CancellationToken

Gets or sets the cancellation token of an asynchronous operations.

public CancellationToken CancellationToken { get; set; }

Property Value

CancellationToken

The cancellation token of an asynchronous operations.