C# | Type.GetHashCode() Method Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 demonstrate the // Type.GetHashCode() Method using System; using System.Globalization; using System.Reflection; using System.Collections.Generic; class GFG { // Main Method public static void Main() { // Declaring and initializing object of Type Type objType = typeof(Dictionary<, >); // Getting hashcode of given type // using GetHashCode() Method int hash = objType.GetHashCode(); // Display the Result Console.Write("Hashcode is {0}", hash); } } Output: Hashcode is 32340152 Example 2: csharp // C# program to demonstrate the // Type.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(typeof(int)); get(typeof(string)); get(typeof(decimal)); get(typeof(float)); } // defining get() method public static void get(Type objType) { // Getting hashcode of given type // using GetHashCode() Method int hash = objType.GetHashCode(); // Display the Result Console.WriteLine("Hashcode of {0} is {1}", objType, hash); } } Output: Hashcode of System.Int32 is 18784216 Hashcode of System.String is 18793840 Hashcode of System.Decimal is 19137544 Hashcode of System.Single is 18792864 Reference: https://learn.microsoft.com/en-us/dotnet/api/system.type.gethashcode?view=netframework-4.8 Comment More infoAdvertise with us Next Article C# | Type.GetInterface() Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Type-Class Similar Reads C# | Uri.GetHashCode() Method 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 t 1 min read C# | Type.GetTypeCode() Method Type.GetTypeCode() Method is used to get the underlying type code of the specified Type. Syntax: public static TypeCode GetTypeCode (Type type); Here, it takes the type whose underlying type code to get. Return Value: This method returns the code of the underlying type, or Empty if type is null. Bel 2 min read C# | Type.GetTypeHandle() Method Type.GetTypeHandle() Method is used to get the handle for the Type of a specified object. Syntax: public static RuntimeTypeHandle GetTypeHandle (object o); Here, it takes the object for which to get the type handle. Return Value: This method returns The handle for the Type of the specified Object. E 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 C# | Type.GetInterface() Method Type.GetInterface() Method is used to gets a specific interface implemented or inherited by the current Type. GetInterface(String) Method This method is used to search for the interface with the specified name. Syntax: public Type GetInterface (string name); Here, it takes the string containing the 4 min read C# | Type.Equals() Method Type.Equals() Method is used to check whether the underlying system type of the current Type is the same as the underlying system type of the specified Object or Type. There are 2 methods in the overload list of this method as follows: Equals(Type) Method Equals(Object) Method Type.Equals(Type) Meth 4 min read Like