Modifica

Condividi tramite


ImmutableInterlocked.GetOrAdd Method

Definition

Overloads

GetOrAdd<TKey,TValue,TArg>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TArg,TValue>, TArg)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

GetOrAdd<TKey,TValue,TArg>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TArg,TValue>, TArg)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

public:
generic <typename TKey, typename TValue, typename TArg>
 static TValue GetOrAdd(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, Func<TKey, TArg, TValue> ^ valueFactory, TArg factoryArgument);
public static TValue GetOrAdd<TKey,TValue,TArg> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, Func<TKey,TArg,TValue> valueFactory, TArg factoryArgument);
static member GetOrAdd : ImmutableDictionary * 'Key * Func<'Key, 'Arg, 'Value> * 'Arg -> 'Value
Public Shared Function GetOrAdd(Of TKey, TValue, TArg) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, valueFactory As Func(Of TKey, TArg, TValue), factoryArgument As TArg) As TValue

Type Parameters

TKey

The type of the keys contained in the collection.

TValue

The type of the values contained in the collection.

TArg

The type of the argument supplied to the value factory.

Parameters

location
ImmutableDictionary<TKey,TValue>

The variable or field to update if the specified is not in the dictionary.

key
TKey

The key for the value to retrieve or add.

valueFactory
Func<TKey,TArg,TValue>

The function to execute to obtain the value to insert into the dictionary if the key is not found.

factoryArgument
TArg

The argument to pass to the value factory.

Returns

TValue

The value at the specified key or valueFactory if the key was not present.

Applies to

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

public:
generic <typename TKey, typename TValue>
 static TValue GetOrAdd(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, Func<TKey, TValue> ^ valueFactory);
public static TValue GetOrAdd<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, Func<TKey,TValue> valueFactory);
static member GetOrAdd : ImmutableDictionary * 'Key * Func<'Key, 'Value> -> 'Value
Public Shared Function GetOrAdd(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, valueFactory As Func(Of TKey, TValue)) As TValue

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 variable or field to atomically update if the specified is not in the dictionary.

key
TKey

The key for the value to retrieve or add.

valueFactory
Func<TKey,TValue>

The function to execute to obtain the value to insert into the dictionary if the key is not found. This delegate will not be invoked more than once.

Returns

TValue

The value at the specified key or valueFactory if the key was not present.

Applies to

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

public:
generic <typename TKey, typename TValue>
 static TValue GetOrAdd(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, TValue value);
public static TValue GetOrAdd<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue value);
static member GetOrAdd : ImmutableDictionary * 'Key * 'Value -> 'Value
Public Shared Function GetOrAdd(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, value As TValue) As TValue

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 variable or field to atomically update if the specified key is not in the dictionary.

key
TKey

The key for the value to get or add.

value
TValue

The value to add to the dictionary the key is not found.

Returns

TValue

The value at the specified key or valueFactory if the key was not present.

Applies to