C# | Uri.GetHashCode() Method Last Updated : 01 May, 2019 Comments Improve Suggest changes Like Article Like Report 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: csharp // 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 string address1 = "http://www.contoso.com/index.htm#search"; // Getting HashCode by // using GetHashCode() method int value = address1.GetHashCode(); // Displaying the result Console.WriteLine("HashCode is : {0}", value); } } Output: HashCode is : 2065713268 Example 2: csharp // C# program to demonstrate the // Uri.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(new Uri("http://www.contoso.com")); get(new Uri("http://www.google.com")); } // 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); } } Output: HashCode is : 2014 HashCode is : 1498 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.uri.gethashcode?view=netstandard-2.1 Comment More infoAdvertise with us Next Article C# | Uri.GetHashCode() Method rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Uri-Class Similar Reads C# | Type.GetHashCode() Method Type.GetHashCode() Method is used to return the hash code for this instance. Syntax: public override int GetHashCode (); Return Value: This method returns the hash code for the current instance. Below programs illustrate the use of Type.GetHashCode() Method: Example 1: csharp // C# program to demons 2 min read C# | Byte.GetHashCode() Method This method is used to return the hash code for the given byte.Syntax: public override int GetHashCode (); Return Value: This method returns a hash code for the current Byte.Below programs illustrate the use of Byte.GetHashCode() Method:Example 1: CSHARP // C# program to demonstrate // Byte.GetHashC 2 min read Double.GetHashCode() Method in C# Double.GetHashCode() Method is used to return the hash code for this instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of Double.GetHashCode() Method: Example 1: csharp // C# program to demonst 1 min read C# | Uri.IsHexEncoding() Method Uri.IsHexEncoding(String, Int32) Method is used to check whether a character in a string is hexadecimal encoded or not. This checks for hexadecimal encoding which follows the pattern "%hexhex" in a string, where "hex" is a digit from 0 to 9 or a letter from A-F (case-insensitive). Syntax: public sta 2 min read C# | Uri.HexEscape(Char) Method Uri.HexEscape(Char) Method is used to convert a specified character into its hexadecimal equivalent. Syntax: public static string HexEscape (char character); Here, it takes the character to convert to hexadecimal representation. Return Value: This method returns the hexadecimal representation of the 1 min read DateTime.GetHashCode() Method in C# This method is used to return the hash code for this instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of DateTime.GetHashCode() Method: Example 1: csharp // C# program to demonstrate the // Da 1 min read C# | CharEnumerator.GetHashCode() Method GetHashCode() Method serves as the default hash function and returns a hash code for the current object. This method is inherited from the Object class. Syntax: public virtual int GetHashCode (); Return Value: This method returns an Int32 value corresponding to the hash code of the current object. B 2 min read C# | Object.GetHashCode() Method with Examples This method is used to return the hash code for this instance. A hash code is a numeric value which is used to insert and identify an object in a hash-based collection. The GetHashCode method provides this hash code for algorithms that need quick checks of object equality. Syntax: public virtual int 2 min read UInt32.GetHashCode Method in C# with Examples UInt32.GetHashCode method is used to get the HashCode for the current UInt32 instance. Syntax: public override int GetHashCode (); Return Value: This method returns a 32-bit signed integer hash code. Below programs illustrate the use of the above discussed-method: Example 1: csharp // C# program to 1 min read Like