ImmutableInterlocked.GetOrAdd 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.
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
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
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
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
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
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
The value at the specified key or valueFactory
if the key was not present.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기