Hashtable.KeyEquals 方法
将特定 Object 与 Hashtable 中的特定键进行比较。
**命名空间:**System.Collections
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Protected Overridable Function KeyEquals ( _
item As Object, _
key As Object _
) As Boolean
用法
Dim item As Object
Dim key As Object
Dim returnValue As Boolean
returnValue = Me.KeyEquals(item, key)
protected virtual bool KeyEquals (
Object item,
Object key
)
protected:
virtual bool KeyEquals (
Object^ item,
Object^ key
)
protected boolean KeyEquals (
Object item,
Object key
)
protected function KeyEquals (
item : Object,
key : Object
) : boolean
参数
- item
要与 key 进行比较的 Object。
- key
要与 item 进行比较的 Hashtable 中的键。
返回值
如果 item 和 key 相等,则为 true;否则为 false。
异常
异常类型 | 条件 |
---|---|
item 为 空引用(在 Visual Basic 中为 Nothing)。 - 或 - key 为 空引用(在 Visual Basic 中为 Nothing)。 |
备注
如果该哈希表是使用特定 IComparer 实现创建的,则此方法使用该比较器,即 Compare(item, key)。否则,它使用 item.Equals(key)
。
此方法是 O(1) 操作。
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0
请参见
参考
Hashtable 类
Hashtable 成员
System.Collections 命名空间
Object 类
Compare
Object.Equals