PostSharp 5.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Extensibility Namespace / IState­Store Interface / IState­Store Methods / IState­Store.​Get­Or­Add(T) Method

IStateStore.GetOrAdd<T> Method

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

Namespace:  PostSharp.Extensibility
Assembly:  PostSharp (in PostSharp.dll) Version: 5.0.55.0 (5.0.55.0)
Syntax
C#
T GetOrAdd<T>(
	Func<T> getter
)

Parameters

getter
Type: System.Func<T>
The delegate invoked if no value of type T is present in the cache.

Type Parameters

T
Type of the value.

Return Value

Type: T
Either the value of type T present in the cache, either the result of the getter delegate.
See Also