PostSharpAPI ReferencePost­Sharp.​ExtensibilityIState­StoreGet­Or­Add
Open sandboxFocus

IStateStore.GetOrAdd Method

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
System.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.