Method
TypedValueDictionary.GetOrAddAsync<T>
GetOrAddAsync<T>(Func<Task<T») #
Asynchronously gets a singleton previously defined in this context bag via its type T.
If it does not exist, it adds the object to the context bag using the provided asynchronous getter function.
public Task<T> GetOrAddAsync<T>(Func<Task<T>> getter) where T : notnullParameters #
An asynchronous function that provides the object to be added if it does not exist.
Returns #
Task<T>
A task that represents the asynchronous operation. The task result contains the object of type T from the context bag.
Type Parameters #
T
The type of the object defined in this context bag.