Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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
[C#]
protected virtual bool KeyEquals(
 object item,
 object key
);
[C++]
protected: virtual bool KeyEquals(
 Object* item,
 Object* key
);
[JScript]
protected function KeyEquals(
   item : Object,
 key : Object
) : Boolean;

Parameters

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

Return Value

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

Exceptions

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

-or-

key is a null reference (Nothing).

Remarks

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

Requirements

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

Show:
© 2015 Microsoft