Skip to content

M_Cyjb_Collections_ObjectModel_DictionaryBase_2_TryGetValue

CYJB edited this page Mar 20, 2024 · 7 revisions

DictionaryBase(TKey, TValue).TryGetValue 方法

获取与指定键关联的值。

Namespace: Cyjb.Collections.ObjectModel
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public abstract bool TryGetValue(
	TKey key,
	out TValue value
)

参数

 

key
Type: TKey
要获取其值的键。
value
Type: TValue
如果找到指定键,则返回与该键相关联的值; 否则返回 value 参数的类型的默认值。

返回值

Type: Boolean
如果当前字典包含具有指定键的元素,则为 true;否则为 false

实现

IDictionary(TKey, TValue).TryGetValue(TKey, TValue)
IReadOnlyDictionary(TKey, TValue).TryGetValue(TKey, TValue)

Exceptions

 

异常 条件
ArgumentNullException keynull

参见

Reference

DictionaryBase(TKey, TValue) 类
Cyjb.Collections.ObjectModel 命名空间

Clone this wiki locally