ConcurrentDictionary<TKey, TValue>::TryUpdate Method (TKey, TValue, TValue)
Compares the existing value for the specified key with a specified value, and if they are equal, updates the key with a third value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- key
-
Type:
TKey
The key whose value is compared with comparisonValue and possibly replaced.
- newValue
-
Type:
TValue
The value that replaces the value of the element that has the specified key if the comparison results in equality.
- comparisonValue
-
Type:
TValue
The value that is compared to the value of the element that has the specified key.
Return Value
Type: System::Booleantrue if the value with key was equal to comparisonValue and was replaced with newValue; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentNullException | key is null. |
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1