次の方法で共有


AsyncLazy<T>(Func<Task<T>>, JoinableTaskFactory) Constructor

Definition

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

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

Parameters

valueFactory
Func<Task<T>>

The async function that produces the value. To be invoked at most once.

joinableTaskFactory
JoinableTaskFactory

The JoinableTaskFactory to use for avoiding deadlocks when the valueFactory or the constructed value's DisposeAsync() method may require the main thread in the process.

Applies to