Decimal.GetHashCode Method in C# with Examples Last Updated : 19 Mar, 2019 Comments Improve Suggest changes Like Article Like Report Decimal.GetHashCode method is used to get the HashCode for the current Decimal 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 illustrate the // Decimal.GetHashCode() Method using System; class GFG { // Main Method public static void Main() { // Taking decimal variables // having fractional part Decimal dec1 = 214748.78549M; // Getting the hash code for Decimal // using GetHashCode() method int result = dec1.GetHashCode(); // Display the time Console.WriteLine("HashCode for Decimal is: {0}", result); } } Output: HashCode for Decimal is: 161795526 Example 2: csharp // C# program to illustrate the // Decimal.GetHashCode() Method using System; class GFG { // Main Method public static void Main() { // using result() Method result(Decimal.MinValue); result(Decimal.MaxValue); } // result() method public static void result(decimal val) { // using GetHashCode() method int code = val.GetHashCode(); // Display the hashcode Console.WriteLine("HashCode for {0} is {1}", val, code); } } Output: HashCode for -79228162514264337593543950335 is -974127104 HashCode for 79228162514264337593543950335 is 1173356544 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.decimal.gethashcode?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article Decimal.GetHashCode Method in C# with Examples K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Decimal-Struct Similar Reads Decimal.GetTypeCode Method in C# with Examples Decimal.GetTypeCode method is used to get the TypeCode for value type Decimal. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant Decimal. Below programs illustrate the use of the above discussed-method: Example 1: csharp // C# program to illustrate the 1 min read Int32.GetHashCode Method in C# with Examples Int32.GetHashCode method is used to get the HashCode for the current Int32 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 il 1 min read Int64.GetHashCode Method in C# with Examples Int64.GetHashCode method is used to get the HashCode for the current Int64 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 il 1 min read Int16.GetHashCode Method in C# with Examples Int16.GetHashCode method is used to get the HashCode for the current Int16 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 il 1 min read Boolean.GetHashCode() Method in C# with Examples Boolean.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 Boolean.GetHashCode() Method: Example 1: csharp // C# program to demon 1 min read Like