Home » C#

C# | Uri.GetHashCode() Method with Example

Uri.GetHashCode() Method: Here, we are going to learn about the GetHashCode() method of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.GetHashCode() Method

Uri.GetHashCode() method is an override method, it returns an integer value to represent hashcode of Uri.

Syntax:

    int Uri.GetHashCode();

Parameter(s):

  • This method does not contain any parameter.

Return value:

The return type of this method is int, it returns an Int32 (int) value containing the hash value generated for this URI.

Example to demonstrate example of Uri.GetHashCode() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create an object of Uri
        Uri Address;

        int hashCode = 0;

        Address = new Uri("http://www.includehelp.com");

        //Get hashcode of Uri 
        hashCode = Address.GetHashCode();
        
        Console.WriteLine("Uri Hash Code: {0}",hashCode);
    }
}

Output

Uri Hash Code: 604841720
Press any key to continue . . .


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.