ImmutableDictionary<TKey,TValue>.Builder.GetValueOrDefault 方法

定義

多載

GetValueOrDefault(TKey, TValue)

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。

GetValueOrDefault(TKey)

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。

GetValueOrDefault(TKey, TValue)

來源:
ImmutableDictionary_2.Builder.cs
來源:
ImmutableDictionary_2.Builder.cs
來源:
ImmutableDictionary_2.Builder.cs

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。

public:
 TValue GetValueOrDefault(TKey key, TValue defaultValue);
public TValue GetValueOrDefault (TKey key, TValue defaultValue);
member this.GetValueOrDefault : 'Key * 'Value -> 'Value
Public Function GetValueOrDefault (key As TKey, defaultValue As TValue) As TValue

參數

key
TKey

要搜尋的索引鍵。

defaultValue
TValue

如果字典中找不到相符的索引鍵時所傳回的預設值。

傳回

TValue

索引鍵的值,或者,如果找不到相符的索引鍵,則為 defaultValue

適用於

GetValueOrDefault(TKey)

來源:
ImmutableDictionary_2.Builder.cs
來源:
ImmutableDictionary_2.Builder.cs
來源:
ImmutableDictionary_2.Builder.cs

如果字典中存在相符的索引鍵,就會取得指定索引鍵的值。

public:
 TValue GetValueOrDefault(TKey key);
public TValue GetValueOrDefault (TKey key);
public TValue? GetValueOrDefault (TKey key);
member this.GetValueOrDefault : 'Key -> 'Value
Public Function GetValueOrDefault (key As TKey) As TValue

參數

key
TKey

要搜尋的索引鍵。

傳回

TValue

索引鍵的值,或者,如果找不到相符的索引鍵,則為 default(TValue)

適用於