IReadOnlyDictionary<TKey,TValue>.ContainsKey(TKey) Метод
Определение
Определяет, содержится ли в словаре, доступном только для чтения, элемент с указанным ключом.Determines whether the read-only dictionary contains an element that has the specified key.
public:
bool ContainsKey(TKey key);
public bool ContainsKey (TKey key);
abstract member ContainsKey : 'Key -> bool
Public Function ContainsKey (key As TKey) As Boolean
Параметры
- key
- TKey
Искомый ключ.The key to locate.
Возвращаемое значение
Значение true
, если в доступном только для чтения словаре содержится элемент с указанным ключом; в противном случае — значение false
.true
if the read-only dictionary contains an element that has the specified key; otherwise, false
.
Исключения
key
имеет значение null
.key
is null
.
Комментарии
Реализации могут различаться в зависимости от того, как они определяют равенство объектов; Например, класс, реализующий, IReadOnlyDictionary<TKey,TValue> может использовать Comparer<T>.Default свойство или реализовать IComparer<T> метод.Implementations can vary in how they determine the equality of objects; for example, the class that implements IReadOnlyDictionary<TKey,TValue> might use the Comparer<T>.Default property, or it might implement the IComparer<T> method.
Реализации могут различаться в зависимости от того, разрешены ли они key
null
.Implementations can vary in whether they allow key
to be null
.