Type.GetHashCode Method

May 11, 2014

Returns the hash code for this instance.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public override int GetHashCode()

Return Value

Type: System.Int32
An Int32 containing the hash code for this instance.

This method overrides Object.GetHashCode.

The following example displays the hash code of the TextBlock class.


using System;
using System.Reflection;

class Example
{
    public static void Demo(System.Windows.Controls.TextBlock outputBlock)
    {
        outputBlock.Text += String.Format(
            "The HashCode of the {1} type is: {0}\n",
            outputBlock.GetType().GetHashCode(),
            outputBlock.GetType().FullName);
    }
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft