Skip to main content
All docs
V21.2

Lists.CreateAsync(ListType) Method

Creates a new list of the specified type.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask<List> CreateAsync(
    ListType listType
)

Parameters

Name Type Description
listType ListType

A list type.

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 cancelled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            List list = await documentAPI.Lists.CreateAsync(ListType.MultiLevel);
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also