DictionaryExtensions.GetOrDefault<TK,TV> Method

Definition

Gets a value by the given key.

C++
public:
generic <typename TK, typename TV>
[System::Runtime::CompilerServices::Extension]
 static TV GetOrDefault(System::Collections::Generic::IDictionary<TK, TV> ^ dictionary, TK key);

Type Parameters

TK

key type

TV

value type

Parameters

dictionary
IDictionary<TK,TV>

dictionary

key
TK

key in the dictionary

Returns

TV

default if key doesn't exist in the dictionary.

Applies to

Produkt Verzie
Visual Studio SDK 2019, 2022