AsyncLazy<T> Class
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.
A thread-safe, lazily and asynchronously evaluated value factory.
generic <typename T>
public ref class AsyncLazy
template <typename T>
[Windows::Foundation::Metadata::WebHostHidden]
class AsyncLazy
public class AsyncLazy<T>
type AsyncLazy<'T> = class
Public Class AsyncLazy(Of T)
Type Parameters
- T
The type of value generated by the value factory.
- Inheritance
-
AsyncLazy<T>
Remarks
This class does not itself carry any resources needful of disposing. But the value factory may produce a value that needs to be disposed of, which is why this class carries a DisposeValueAsync() method but does not implement IDisposable.
Constructors
AsyncLazy<T>(Func<Task<T>>, JoinableTaskFactory) |
Initializes a new instance of the AsyncLazy<T> class. |
Properties
IsValueCreated |
Gets a value indicating whether the value factory has been invoked. |
IsValueDisposed |
Gets a value indicating whether DisposeValue() has already been called. |
IsValueFactoryCompleted |
Gets a value indicating whether the value factory has been invoked and has run to completion. |
SuppressRecursiveFactoryDetection |
Gets a value indicating whether to suppress detection of a value factory depending on itself. |
Methods
DisposeValue() |
Disposes of the lazily-initialized value if disposable, and causes all subsequent attempts to obtain the value to fail. |
DisposeValueAsync() |
Disposes of the lazily-initialized value if disposable, and causes all subsequent attempts to obtain the value to fail. |
GetValue() |
Gets the lazily computed value. |
GetValue(CancellationToken) |
Gets the lazily computed value. |
GetValueAsync() |
Gets the task that produces or has produced the value. |
GetValueAsync(CancellationToken) |
Gets the task that produces or has produced the value. |
SuppressRelevance() |
Marks the code that follows as irrelevant to the receiving AsyncLazy<T> value factory. |
ToString() |
Renders a string describing an uncreated value, or the string representation of the created value. |
Applies to
Thread Safety
This type is thread-safe for all members.