AsyncLazy<T> Constructor
Initializes a new instance of AsyncLazy.
Namespace: Microsoft.VisualStudio.Threading
Assembly: Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)
Syntax
'Declaration
Public Sub New ( _
valueFactory As Func(Of Task(Of T)), _
joinableTaskFactory As JoinableTaskFactory _
)
public AsyncLazy(
Func<Task<T>> valueFactory,
JoinableTaskFactory joinableTaskFactory
)
public:
AsyncLazy(
Func<Task<T>^>^ valueFactory,
JoinableTaskFactory^ joinableTaskFactory
)
new :
valueFactory:Func<Task<'T>> *
joinableTaskFactory:JoinableTaskFactory -> AsyncLazy
public function AsyncLazy(
valueFactory : Func<Task<T>>,
joinableTaskFactory : JoinableTaskFactory
)
Parameters
valueFactory
Type: System.Func<Task<T>>The asynchronous function that produces the value. the function should be invoked at most once.
joinableTaskFactory
Type: Microsoft.VisualStudio.Threading.JoinableTaskFactoryThe factory to use when invoking the value factory in GetValueAsync to avoid deadlocks when the main thread is required by the value factory.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.