Hashtable.EqualityComparer 屬性

定義

取得 IEqualityComparer 所使用的 HashtableGets the IEqualityComparer to use for the Hashtable.

protected:
 property System::Collections::IEqualityComparer ^ EqualityComparer { System::Collections::IEqualityComparer ^ get(); };
protected System.Collections.IEqualityComparer EqualityComparer { get; }
protected System.Collections.IEqualityComparer? EqualityComparer { get; }
member this.EqualityComparer : System.Collections.IEqualityComparer
Protected ReadOnly Property EqualityComparer As IEqualityComparer

屬性值

IEqualityComparer

IEqualityComparer 所使用的 HashtableThe IEqualityComparer to use for the Hashtable.

例外狀況

屬性設為值,但使用 IHashCodeProviderIComparer 建立雜湊資料表。The property is set to a value, but the hash table was created using an IHashCodeProvider and an IComparer.

備註

IEqualityComparer包含比較子和雜湊程式碼提供者。The IEqualityComparer includes both the comparer and the hash code provider. 如果在函式 IEqualityComparer 中使用 Hashtable ,則在中用來做為索引鍵的物件 Hashtable 不需要覆寫 Object.GetHashCodeObject.Equals 方法。If an IEqualityComparer is used in the Hashtable constructor, the objects used as keys in the Hashtable are not required to override the Object.GetHashCode and Object.Equals methods.

抓取這個屬性的值是一項作業 O(1)Retrieving the value of this property is an O(1) operation.

適用於

另請參閱