This documentation is archived and is not being maintained.

Hashtable.KeyEquals Method

Compares a specific Object with a specific key in the Hashtable.

[Visual Basic]
Protected Overridable Function KeyEquals( _
   ByVal item As Object, _
   ByVal key As Object _
) As Boolean
protected virtual bool KeyEquals(
 object item,
 object key
protected: virtual bool KeyEquals(
 Object* item,
 Object* key
protected function KeyEquals(
   item : Object,
 key : Object
) : Boolean;


The Object to compare with key.
The key in the Hashtable to compare with item.

Return Value

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


Exception Type Condition
ArgumentNullException item is a null reference (Nothing in Visual Basic).


key is a null reference (Nothing).


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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Hashtable Class | Hashtable Members | System.Collections Namespace | Object | Compare | Object.Equals