Open sandboxFocus

Method GetOrAdd

GetOrAdd<T>(Func<T>)

Gets a value from the cache or adds it if it does not exist yet.

Declaration
T GetOrAdd<T>(Func<T> getter)
Parameters
Type Name Description
Func<T> getter

The delegate invoked if no value of type T is present in the cache.

Returns
Type Description
T

Either the value of type T present in the cache, either the result of the getter delegate.

Type Parameters
Name Description
T

Type of the value.