ImmutableDictionary.GetValueOrDefault メソッド

定義

オーバーロード

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

一致するキーがディクショナリ内に存在する場合は指定されたキーの値を取得します。

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

一致するキーがディクショナリ内に存在する場合は指定されたキーの値を取得します。

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

一致するキーがディクショナリ内に存在する場合は指定されたキーの値を取得します。

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

型パラメーター

TKey

キーの型。

TValue

値の型。

パラメーター

dictionary
IImmutableDictionary<TKey,TValue>

値の取得元となるディクショナリ。

key
TKey

検索対象のキー。

defaultValue
TValue

ディクショナリ内に一致するキーが見つからない場合に返される既定値。

戻り値

TValue

キーの値、または一致するキーが見つからなかった場合は defaultValue

適用対象

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

一致するキーがディクショナリ内に存在する場合は指定されたキーの値を取得します。

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

型パラメーター

TKey

キーの型。

TValue

値の型。

パラメーター

dictionary
IImmutableDictionary<TKey,TValue>

値の取得元となるディクショナリ。

key
TKey

検索対象のキー。

戻り値

TValue

キーの値、または一致するキーが見つからなかった場合は default(TValue)

適用対象