Partager via


AsyncLazyInitializer(Func<Task>, JoinableTaskFactory) Constructor

Definition

Initializes a new instance of the AsyncLazyInitializer class.

public AsyncLazyInitializer (Func<System.Threading.Tasks.Task> action, Microsoft.VisualStudio.Threading.JoinableTaskFactory? joinableTaskFactory = default);
new Microsoft.VisualStudio.Threading.AsyncLazyInitializer : Func<System.Threading.Tasks.Task> * Microsoft.VisualStudio.Threading.JoinableTaskFactory -> Microsoft.VisualStudio.Threading.AsyncLazyInitializer
Public Sub New (action As Func(Of Task), Optional joinableTaskFactory As JoinableTaskFactory = Nothing)

Parameters

action
Func<Task>

The action to perform at most once, that has some desirable side-effect.

joinableTaskFactory
JoinableTaskFactory

The factory to use when invoking the action in InitializeAsync(CancellationToken) to avoid deadlocks when the main thread is required by the action.

Applies to