語言

ImmutableDictionary.GetValueOrDefault 方法

定義

多載

名稱 Description
GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey)

如果字典中有相符的索引鍵,則取得指定索引鍵的值。

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

如果字典中有相符的索引鍵,則取得指定索引鍵的值。

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

來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs

如果字典中有相符的索引鍵,則取得指定索引鍵的值。

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) 的值。

適用於

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

來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs
來源:
ImmutableDictionary.cs

如果字典中有相符的索引鍵,則取得指定索引鍵的值。

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 的值。

適用於