ICacheTKey, TValueGetOrAdd Method |
Adds a key/value pair to the cache if the key does not already exist.
Namespace: Beerendonk.MemoizationAssembly: Memoization (in Memoization.dll) Version: 1.0.0.0 (1.0.0.0)
SyntaxTValue GetOrAdd(
TKey key,
Func<TKey, TValue> valueFactory
)
Parameters
- key
- Type: TKey
The key of the element to add. - valueFactory
- Type: SystemFuncTKey, TValue
The function used to generate a value for the key.
Return Value
Type:
TValue
The value for the key. This will be either the existing value for the key if
the key is already in the cache, or the new value for the key as returned by
valueFactory if the key was not in the cache.
See Also