Type.GetHashCode Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Returns the hash code for this instance.

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

Syntax

Public Overrides Function GetHashCode As Integer
public override int GetHashCode()

Return Value

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

Remarks

This method overrides Object..::.GetHashCode.

Examples

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

Imports System.Reflection

Class Example

    Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

        outputBlock.Text &= String.Format( _
            "The HashCode of the {1} type is: {0}" & vbLf, _
            outputBlock.GetType().GetHashCode(), _
            outputBlock.GetType().FullName)
   End Sub 
End 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);
    }
}

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Type Class

System Namespace