Uri.GetHashCode() Method is used to get the hash code for the URI.
Syntax: public override int GetHashCode ();
Return Value: This method returns an Int32 containing the hash value generated for this URI.
Below programs illustrate the use of Uri.GetHashCode() Method:
Example 1:
// C# program to demonstrate the // Uri.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing address1 // Getting HashCode by // using GetHashCode() method int value = address1.GetHashCode(); // Displaying the result Console.WriteLine("HashCode is : {0}", value); } } |
chevron_right
filter_none
Output:
HashCode is : 2065713268
Example 2:
// C# program to demonstrate the // Uri.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method } // defining get() method public static void get(Uri address1) { // Getting HashCode by // using GetHashCode() method int value = address1.GetHashCode(); // Displaying the result Console.WriteLine("HashCode is : {0}", value); } } |
chevron_right
filter_none
Output:
HashCode is : 2014 HashCode is : 1498
Reference:
Recommended Posts:
- Difference between Method Overriding and Method Hiding in C#
- C# | Uri.MakeRelativeUri(Uri) Method
- Array.GetValue() Method in C# with Examples | Set - 1
- C# | CharEnumerator.MoveNext() Method
- C# | Math.IEEERemainder() Method
- C# | Substring() Method
- C# | IndexOfAny() Method
- C# | CharEnumerator.GetType() Method
- File.GetLastWriteTimeUtc() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- Double.CompareTo Method in C# with Examples
- C# | Graphics.DrawLine() Method | Set - 1
- UInt16.GetHashCode Method in C# with Examples
- Stack.Peek Method in C#
- C# | IsNullOrEmpty() Method
- C# | Math.Sign() Method
- Int64.CompareTo Method in C# with Examples
- C# | PadRight() Method
- How to use Array.BinarySearch() Method in C# | Set -1
- C# | EndsWith() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

