This method is used to return the hash code for this instance. A hash code is a numeric value which is used to insert and identify an object in a hash-based collection. The
GetHashCode method provides this hash code for algorithms that need quick checks of object equality.
Syntax:
public virtual int GetHashCode ();
Return Value: This method returns a 32-bit signed integer hash code for the current object.
Below programs illustrate the use of
Object.GetHashCode() Method:
Example 1:
Output:
Type is :System.Object
Hash Code is :37162120
Example 2: