Boolean.GetHashCode() Method in C# with Examples Last Updated : 23 Apr, 2019 Comments Improve Suggest changes Like Article Like Report 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 demonstrate the // Boolean.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 bool value1 = true; // getting the HashCode // using GetHashCode() method int value = value1.GetHashCode(); // Display the HashCode Console.WriteLine("HashCode is {0}", value); } } Output: HashCode is 1 Example 2: csharp // C# program to demonstrate the // Boolean.GetHashCode() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(true); get(false); } // defining get() method public static void get(bool value1) { // getting the HashCode // using GetHashCode() method int value = value1.GetHashCode(); // Display the HashCode Console.WriteLine("HashCode is {0}", value); } } Output: HashCode is 1 HashCode is 0 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.boolean.gethashcode?view=netframework-4.8 Comment More infoAdvertise with us Next Article Boolean.GetHashCode() Method in C# with Examples K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Boolean-Struct Similar Reads Boolean.GetTypeCode Method in C# with Examples Boolean.GetTypeCode method is used to get the TypeCode for value type Boolean. Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant Boolean. 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 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 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 SByte.GetHashCode Method in C# with Examples SByte.GetHashCode method is used to get the HashCode for the current SByte 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 Like