ThreadSafeDictionaryTKey, TValueAddOrUpdate(TKey, TValue, TValue) Method

Adds or updates a key/value pair in the ThreadSafeDictionaryTKey, TValue based on whether the specified key already exists.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public TValue AddOrUpdate(
	TKey key,
	TValue addValue,
	TValue updateValue
)

Parameters

key  TKey
The key to be added or whose value should be updated.
addValue  TValue
The value to be added for an absent key.
updateValue  TValue
The value to be set for an existing key.

Return Value

TValue
The new value for the key. This will be either addValue (if the key was absent) or updateValue (if the key was present).

Exceptions

See Also