Method GetOrAddAsync
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 : notnull
Parameters
getterFunc<Task<T>>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
Tfrom the context bag.
Type Parameters
TThe type of the object defined in this context bag.
English
Русский
Português
Español
Deutsch
中文 (简体)
日本語