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 JoinableTaskFactory to use for avoiding deadlocks when the valueFactory
or the constructed value's DisposeAsync() method may require the main thread in the process.