-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_DictionaryExtensions_GetOrAdd__2_2
Andrew Koryavchenko edited this page Jun 17, 2018
·
6 revisions
Adds a key/value pair to the IDictionary(TKey, TValue) if the key does not already exist.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static TValue GetOrAdd<TKey, TValue>(
this IDictionary<TKey, TValue> dictionary,
TKey key,
TValue value
)
VB
<ExtensionAttribute>
Public Shared Function GetOrAdd(Of TKey, TValue) (
dictionary As IDictionary(Of TKey, TValue),
key As TKey,
value As TValue
) As TValue
F#
[<ExtensionAttribute>]
static member GetOrAdd :
dictionary : IDictionary<'TKey, 'TValue> *
key : 'TKey *
value : 'TValue -> 'TValue
- dictionary
- Type: System.Collections.Generic.IDictionary(TKey, TValue)
The dictionary. - key
- Type: TKey
The key of the element to add. - value
- Type: TValue
the value to be added, if the key does not already exist
- TKey
- [Missing documentation for "M:CodeJam.Collections.DictionaryExtensions.GetOrAdd
2(System.Collections.Generic.IDictionary{
0,1},
0,1)"\]</dd><dt>TValue</dt><dd>\[Missing <typeparam name="TValue"/> documentation for "M:CodeJam.Collections.DictionaryExtensions.GetOrAdd
2(System.Collections.Generic.IDictionary{0,
1},0,
1)"]
Type: TValue
The value for the key. This will be either the existing value for the key if the key is already in the dictionary, or the new value if the key was not in the dictionary.
In Visual Basic and C#, you can call this method as an instance method on any object of type IDictionary(TKey, 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).
DictionaryExtensions Class
GetOrAdd Overload
CodeJam.Collections Namespace