ImmutableDictionary.GetValueOrDefault Metoda

Definice

Přetížení

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

Získá hodnotu pro daný klíč, pokud odpovídající klíč existuje ve slovníku.

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

Získá hodnotu pro daný klíč, pokud odpovídající klíč existuje ve slovníku.

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

Získá hodnotu pro daný klíč, pokud odpovídající klíč existuje ve slovníku.

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 klíče.

TValue

Typ hodnoty

Parametry

dictionary
IImmutableDictionary<TKey,TValue>

Slovník pro načtení hodnoty z.

key
TKey

Klíč, který chcete vyhledat.

defaultValue
TValue

Výchozí hodnota, která se má vrátit, pokud se ve slovníku nenajde žádný odpovídající klíč.

Návraty

TValue

Hodnota klíče nebo defaultValue pokud nebyl nalezen žádný odpovídající klíč.

Platí pro

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

Získá hodnotu pro daný klíč, pokud odpovídající klíč existuje ve slovníku.

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 klíče.

TValue

Typ hodnoty

Parametry

dictionary
IImmutableDictionary<TKey,TValue>

Slovník pro načtení hodnoty z.

key
TKey

Klíč, který chcete vyhledat.

Návraty

TValue

Hodnota klíče nebo default(TValue), pokud nebyl nalezen žádný odpovídající klíč.

Platí pro