Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetValueOrDefault< TKey, TValue >() [2/2]

static TValue System.Collections.Generic.CollectionExtensions.GetValueOrDefault< TKey, TValue > ( this IReadOnlyDictionary< TKey, TValue > dictionary,
TKey key,
TValue defaultValue )
inlinestatic

Definition at line 12 of file CollectionExtensions.cs.

13 {
14 if (dictionary == null)
15 {
16 throw new ArgumentNullException("dictionary");
17 }
18 if (!dictionary.TryGetValue(key, out TValue value))
19 {
20 return defaultValue;
21 }
22 return value;
23 }

References System.dictionary, System.key, and System.value.