Hashtable.GetHash(Object) 方法

定義

傳回指定索引鍵的雜湊程式碼。Returns the hash code for the specified key.

protected:
 virtual int GetHash(System::Object ^ key);
protected virtual int GetHash (object key);
abstract member GetHash : obj -> int
override this.GetHash : obj -> int
Protected Overridable Function GetHash (key As Object) As Integer

參數

key
Object

要傳回雜湊碼的 ObjectThe Object for which a hash code is to be returned.

傳回

key 的雜湊程式碼。The hash code for key.

例外狀況

keynullkey is null.

備註

如果雜湊表是以特定的 IHashCodeProvider 實作為建立的,則此方法會使用該雜湊碼提供者;否則,它會使用 keyObject.GetHashCode 執行。If the hash table was created with a specific IHashCodeProvider implementation, this method uses that hash code provider; otherwise, it uses the Object.GetHashCode implementation of key.

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

適用於

另請參閱