Uri.GetHashCode Method

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

Gets the hash code for the URI.

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


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

Return Value

Type: System..::.Int32
An Int32 containing the hash value generated for this URI.


The following example creates a Uri instance and writes the hash code to the console.

' Create Uri
Dim uriAddress1 As Uri = New Uri("http://www.contoso.com/index.htm#search")
outputBlock.Text &= uriAddress1.Fragment
outputBlock.Text &= vbCrLf

outputBlock.Text &= "Hash code: "
outputBlock.Text &= uriAddress1.GetHashCode()
outputBlock.Text &= vbCrLf
// Create Uri
Uri uriAddress1 = new Uri("http://www.contoso.com/index.htm#search");
outputBlock.Text += uriAddress1.Fragment;
outputBlock.Text += "\n";

outputBlock.Text += "Hash code: ";
outputBlock.Text += uriAddress1.GetHashCode();
outputBlock.Text += "\n";

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0


Windows Phone

See Also


Uri Class

System Namespace