Skip to main content

Lists.CreateAsync(ListType, CancellationToken) Method

Creates a new list of the specified type.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v23.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask<List> CreateAsync(
    ListType listType,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
listType ListType

A list type.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
ValueTask<List>

A structure that stores an awaitable result of an asynchronous operation. The awaitable result is a list object.

Remarks

Pass the ListType enumeration’s value to the CreateAsync(ListType) method to create a list of the specified type. The type of an existing list cannot be changed.

<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            List multiLevelList = await documentAPI.Lists.CreateAsync(ListType.MultiLevel);
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also