Muokkaa

Jaa


ImmutableInterlocked.AddOrUpdate Method

Definition

Overloads

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

TValue

The added or updated value.

Applies to

AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, 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, 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

TValue

The added or updated value.

Applies to