<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.1.1" />

Nito.AsyncEx.AsyncLazy<T>

public sealed class AsyncLazy<T>
Provides support for asynchronous lazy initialization. This type is fully threadsafe.
public int Id { get; }

Gets a semi-unique identifier for this asynchronous lazy instance.

public bool IsStarted { get; }

Whether the asynchronous factory method has started. This is initially false and becomes true when this instance is awaited or after Start is called.

public Task<T> Task { get; }

Starts the asynchronous factory method, if it has not already started, and returns the resulting task.

public AsyncLazy(Func<Task<T>> factory, AsyncLazyFlags flags = 0)

Initializes a new instance of the AsyncLazy<T> class.

public ConfiguredTaskAwaitable<T> ConfigureAwait(bool continueOnCapturedContext)

Asynchronous infrastructure support. This method permits instances of AsyncLazy<T> to be await'ed.

public TaskAwaiter<T> GetAwaiter()

Asynchronous infrastructure support. This method permits instances of AsyncLazy<T> to be await'ed.

public void Start()

Starts the asynchronous initialization, if it has not already started.