ImmutableInterlocked.AddOrUpdate Method
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.
AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>, Func<TKey,TValue,TValue>) |
Obtains the value from a dictionary after having added it or updated an existing entry. |
AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue, Func<TKey,TValue,TValue>) |
Obtains the value from a dictionary after having added it or updated an existing entry. |
AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>, Func<TKey,TValue,TValue>)
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
Obtains the value from a dictionary after having added it or updated an existing entry.
public:
generic <typename TKey, typename TValue>
static TValue AddOrUpdate(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, Func<TKey, TValue> ^ addValueFactory, Func<TKey, TValue, TValue> ^ updateValueFactory);
public static TValue AddOrUpdate<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, Func<TKey,TValue> addValueFactory, Func<TKey,TValue,TValue> updateValueFactory);
static member AddOrUpdate : ImmutableDictionary * 'Key * Func<'Key, 'Value> * Func<'Key, 'Value, 'Value> -> 'Value
Public Shared Function AddOrUpdate(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, addValueFactory As Func(Of TKey, TValue), updateValueFactory As Func(Of TKey, TValue, TValue)) As TValue
Type Parameters
- TKey
The type of key stored by the dictionary.
- TValue
The type of value stored by the dictionary.
Parameters
- location
- ImmutableDictionary<TKey,TValue>
The variable or field to atomically update if the specified is not in the dictionary.
- key
- TKey
The key for the value to add or update.
- addValueFactory
- Func<TKey,TValue>
The function that receives the key and returns a new value to add to the dictionary when no value previously exists.
- updateValueFactory
- Func<TKey,TValue,TValue>
The function that receives the key and prior value and returns the new value with which to update the dictionary.
Returns
The added or updated value.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
UWP | 10.0 |
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
- Source:
- ImmutableInterlocked.cs
Obtains the value from a dictionary after having added it or updated an existing entry.
public:
generic <typename TKey, typename TValue>
static TValue AddOrUpdate(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, TValue addValue, Func<TKey, TValue, TValue> ^ updateValueFactory);
public static TValue AddOrUpdate<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue addValue, Func<TKey,TValue,TValue> updateValueFactory);
static member AddOrUpdate : ImmutableDictionary * 'Key * 'Value * Func<'Key, 'Value, 'Value> -> 'Value
Public Shared Function AddOrUpdate(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, addValue As TValue, updateValueFactory As Func(Of TKey, TValue, TValue)) As TValue
Type Parameters
- TKey
The type of key stored by the dictionary.
- TValue
The type of value stored by the dictionary.
Parameters
- location
- ImmutableDictionary<TKey,TValue>
The variable or field to atomically update if the specified is not in the dictionary.
- key
- TKey
The key for the value to add or update.
- addValue
- TValue
The value to use if no previous value exists.
- updateValueFactory
- Func<TKey,TValue,TValue>
The function that receives the key and prior value and returns the new value with which to update the dictionary.
Returns
The added or updated value.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: