ImmutableDictionary.GetValueOrDefault 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue) | 
						 如果字典中存在匹配的键,则获取给定键的值。  | 
        	
| GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey) | 
						 如果字典中存在匹配的键,则获取给定键的值。  | 
        	
GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey, TValue)
- Source:
 - ImmutableDictionary.cs
 
- Source:
 - ImmutableDictionary.cs
 
- Source:
 - 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
 
在字典中找不到匹配键时返回的默认值。
返回
该键的值;如果找不到匹配的键,则为 defaultValue。
适用于
GetValueOrDefault<TKey,TValue>(IImmutableDictionary<TKey,TValue>, TKey)
- Source:
 - ImmutableDictionary.cs
 
- Source:
 - ImmutableDictionary.cs
 
- Source:
 - 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
 
要搜索的键。
返回
该键的值;如果找不到匹配的键,则为 default(TValue)。