Hashtable.GetHash(Object) Hashtable.GetHash(Object) Hashtable.GetHash(Object) Hashtable.GetHash(Object) Method

定义

返回指定键的哈希代码。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 Object Object Object

Object,将为其返回哈希代码。The Object for which a hash code is to be returned.

返回

key 的哈希代码。The hash code for key.

异常

注解

如果哈希表是使用特定IHashCodeProvider实现创建的, 则此方法将使用该哈希代码提供程序; 否则, 它将Object.GetHashCode使用的实现keyIf 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.

适用于

另请参阅