IDictionaryExtensionsAddOrGetTKey, TValue(IDictionaryTKey, TValue, TKey, FuncTKey, TValue) Method
Adds the specified key and value to the specified IDictionaryTKey, TValue
if the key does not already exist, and returns the value.
Namespace: DevCase.Extensions.IDictionaryExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static TValue AddOrGet<TKey, TValue>(
this IDictionary<TKey, TValue> sender,
TKey key,
Func<TKey, TValue> valueFactory
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function AddOrGet(Of TKey, TValue) (
sender As IDictionary(Of TKey, TValue),
key As TKey,
valueFactory As Func(Of TKey, TValue)
) As TValue
Dim sender As IDictionary(Of TKey, TValue)
Dim key As TKey
Dim valueFactory As Func(Of TKey, TValue)
Dim returnValue As TValue
returnValue = sender.AddOrGet(key,
valueFactory)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename TKey, typename TValue>
static TValue AddOrGet(
IDictionary<TKey, TValue>^ sender,
TKey key,
Func<TKey, TValue>^ valueFactory
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member AddOrGet :
sender : IDictionary<'TKey, 'TValue> *
key : 'TKey *
valueFactory : Func<'TKey, 'TValue> -> 'TValue
No code example is currently available or this language may not be supported.
- sender IDictionaryTKey, TValue
-
The source IDictionaryTKey, TValue.
- key TKey
-
The key to add.
- valueFactory FuncTKey, TValue
-
A function used to generate a value for the key.
- TKey
- TValue
TValue
The value.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IDictionaryTKey,
TValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).