Hashtable.KeyEquals(Object, Object) Method

Definition

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);
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

Parameters

item
Object

The Object to compare with key.

key
Object

The key in the Hashtable to compare with item.

Returns

Boolean

true if item and key are equal; otherwise, false.

Exceptions

item is null.

-or-

key is null.

Remarks

If the hash table was created with a specific IComparer implementation, this method uses that comparer; that is, Compare (item, key). Otherwise, it uses item.Equals(key).

This method is an O(1) operation.

Applies to

See also