ImmutableDictionary.GetValueOrDefault Metoda

Definicja

Przeciążenia

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue)

Pobiera wartość danego klucza, jeśli w słowniku istnieje pasujący klucz.

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey)

Pobiera wartość danego klucza, jeśli w słowniku istnieje pasujący klucz.

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue)

Pobiera wartość danego klucza, jeśli w słowniku istnieje pasujący klucz.

public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
 static TValue GetValueOrDefault(System::Collections::Immutable::IImmutableDictionary<TKey, TValue> ^ dictionary, TKey key, TValue defaultValue);
public static TValue GetValueOrDefault<TKey,TValue> (this System.Collections.Immutable.IImmutableDictionary<TKey,TValue> dictionary, TKey key, TValue defaultValue);
static member GetValueOrDefault : System.Collections.Immutable.IImmutableDictionary<'Key, 'Value> * 'Key * 'Value -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TKey, TValue) (dictionary As IImmutableDictionary(Of TKey, TValue), key As TKey, defaultValue As TValue) As TValue

Parametry typu

TKey

Typ klucza.

TValue

Typ wartości.

Parametry

dictionary
IImmutableDictionary<TKey,TValue>

Słownik, z który ma pobrać wartość.

key
TKey

Klucz do wyszukania.

defaultValue
TValue

Wartość domyślna, która ma być zwracana, jeśli w słowniku nie znaleziono pasującego klucza.

Zwraca

TValue

Wartość klucza lub defaultValue jeśli nie znaleziono pasującego klucza.

Dotyczy

GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey)

Pobiera wartość danego klucza, jeśli w słowniku istnieje pasujący klucz.

public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
 static TValue GetValueOrDefault(System::Collections::Immutable::IImmutableDictionary<TKey, TValue> ^ dictionary, TKey key);
public static TValue GetValueOrDefault<TKey,TValue> (this System.Collections.Immutable.IImmutableDictionary<TKey,TValue> dictionary, TKey key);
public static TValue? GetValueOrDefault<TKey,TValue> (this System.Collections.Immutable.IImmutableDictionary<TKey,TValue> dictionary, TKey key);
static member GetValueOrDefault : System.Collections.Immutable.IImmutableDictionary<'Key, 'Value> * 'Key -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TKey, TValue) (dictionary As IImmutableDictionary(Of TKey, TValue), key As TKey) As TValue

Parametry typu

TKey

Typ klucza.

TValue

Typ wartości.

Parametry

dictionary
IImmutableDictionary<TKey,TValue>

Słownik, z który ma pobrać wartość.

key
TKey

Klucz do wyszukania.

Zwraca

TValue

Wartość klucza lub default(TValue), jeśli nie znaleziono pasującego klucza.

Dotyczy