ImmutableInterlocked.TryUpdate<TKey,TValue> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the specified key to the specified value if the specified key already is set to a specific value.
public:
generic <typename TKey, typename TValue>
static bool TryUpdate(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, TValue newValue, TValue comparisonValue);
public static bool TryUpdate<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue newValue, TValue comparisonValue);
static member TryUpdate : ImmutableDictionary * 'Key * 'Value * 'Value -> bool
Public Shared Function TryUpdate(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, newValue As TValue, comparisonValue As TValue) As Boolean
Type Parameters
- TKey
The type of the keys contained in the collection.
- TValue
The type of the values contained in the collection.
Parameters
- location
- ImmutableDictionary<TKey,TValue>
The dictionary to update.
- key
- TKey
The key to update.
- newValue
- TValue
The new value to set.
- comparisonValue
- TValue
The current value for key
in order for the update to succeed.
Returns
true
if key
and comparisonValue
are present in the dictionary and comparison was updated to newValue
; otherwise, false
.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈