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

要和 Object 比較的 keyThe Object to compare with key.

key
Object

要和 Hashtable 比較的 item 索引鍵。The key in the Hashtable to compare with item.

傳回

如果 trueitem 相等,則為 key;否則為 falsetrue if item and key are equal; otherwise, false.

例外狀況

itemnullitem is null.

-或--or- keynullkey is null.

備註

如果雜湊表是以特定的 IComparer 實作為建立的,則此方法會使用該比較子;也就是 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).

這個方法是 O(1) 作業。This method is an O(1) operation.

適用於

另請參閱