ThreadSafeDictionaryTKey, TValueTryUpdate Method

Updates the value associated with key to newValue if the existing value with key is equal to originalValue.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public bool TryUpdate(
	TKey key,
	TValue newValue,
	TValue originalValue
)

Parameters

key  TKey
The key of the item to replace.
newValue  TValue
The replacement value of key if its value equals to originalValue.
originalValue  TValue
The expected original value of the stored item with the associated key.

Return Value

Boolean
if the value with key was equal to originalValue and was replaced with newValue; otherwise, .

Exceptions

See Also