你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
OtherExtensions.GetValueOrDefault<T> 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取与指定键关联的值。
public static T GetValueOrDefault<T> (this System.Collections.Generic.IDictionary<string,object> dictionary, string key);
static member GetValueOrDefault : System.Collections.Generic.IDictionary<string, obj> * string -> 'T
<Extension()>
Public Function GetValueOrDefault(Of T) (dictionary As IDictionary(Of String, Object), key As String) As T
类型参数
- T
值参数的类型。
参数
- dictionary
- IDictionary<String,Object>
包含指定键的字典。
- key
- String
要获取其值的键。
返回
T
如果找到指定键,则为与指定键关联的值;否则为值参数类型的默认值。