Hashtable.KeyEquals(Object, Object) 方法

定义

将特定 ObjectHashtable 中的特定键进行比较。Compares a specific Object with a specific key in the Hashtable.

protected:
 virtual bool KeyEquals(System::Object ^ item, System::Object ^ key);
protected virtual bool KeyEquals (object item, object key);
abstract member KeyEquals : obj * obj -> bool
override this.KeyEquals : obj * obj -> bool
Protected Overridable Function KeyEquals (item As Object, key As Object) As Boolean

参数

item
Object

要与 key 进行比较的 ObjectThe Object to compare with key.

key
Object

要与 item 进行比较的 Hashtable 中的键。The key in the Hashtable to compare with item.

返回

如果 itemkey 相等,则为 true;否则为 falsetrue if item and key are equal; otherwise, false.

异常

itemnullitem is null.

-or- keynullkey is null.

注解

如果哈希表是使用特定的 @no__t 0 实现创建的,则此方法将使用该比较器;也就是说,Compareitemkey)。If the hash table was created with a specific IComparer implementation, this method uses that comparer; that is, Compare (item, key). 否则,它使用 item.Equals(key)Otherwise, it uses item.Equals(key).

此方法是 @no__t 0 操作。This method is an O(1) operation.

适用于

另请参阅