Partager via


AsyncLazyInitializer Class

Definition

Lazily executes a delegate that has some side effect (typically initializing something) such that the delegate runs at most once.

public ref class AsyncLazyInitializer
public class AsyncLazyInitializer
type AsyncLazyInitializer = class
Public Class AsyncLazyInitializer
Inheritance
AsyncLazyInitializer

Constructors

AsyncLazyInitializer(Func<Task>, JoinableTaskFactory)

Initializes a new instance of the AsyncLazyInitializer class.

Properties

IsCompleted

Gets a value indicating whether the action has executed completely, regardless of whether it threw an exception.

IsCompletedSuccessfully

Gets a value indicating whether the action has executed completely without throwing an exception.

Methods

Initialize(CancellationToken)

Executes the action given in the constructor if it has not yet been executed, or waits for it to complete if in progress from a prior call.

InitializeAsync(CancellationToken)

Executes the action given in the constructor if it has not yet been executed, or waits for it to complete if in progress from a prior call.

Applies to