AsyncLazy<T>(Func<Task<T>>, JoinableTaskFactory) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- joinableTaskFactory
- JoinableTaskFactory
The factory to use when invoking the value factory in GetValueAsync(CancellationToken) to avoid deadlocks when the main thread is required by the value factory.