C# | Boolean.Equals(Boolean) Method Last Updated : 01 Feb, 2023 Comments Improve Suggest changes Like Article Like Report This method is used to return a value indicating whether this instance is equal to a specified Boolean object.Syntax: public bool Equals (bool obj); Here, obj is a boolean value to compare to this instance.Return Value: This method returns true if obj has the same value as this instance otherwise it returns false.Below programs illustrate the use of Boolean.Equals(bool obj) Method:Example 1: CSHARP // C# program to demonstrate // Boolean.Equals(bool obj) // Method using System; class GFG { // Main Method public static void Main() { // passing different values // to the method to check check(true, true); check(true, false); check(false, true); check(false, false); } // Defining check method public static void check(bool input1, bool input2) { // declaring bool variable bool val; // Checking the equality val = input1.Equals(input2); // checking the equivalency if (val == true) Console.WriteLine("{0} is equal to {1}", input1, input2); else Console.WriteLine("{0} is not equal to {1}", input1, input2); } } Output: True is equal to True True is not equal to False False is not equal to True False is equal to False Example 2: CSHARP // C# program to demonstrate // Boolean.Equals(bool obj) // Method using System; class GFG { // Main Method public static void Main() { // Declaring the variable // input1 and input2 bool input1, input2; // initializing the variables input1 = true; input2 = false; // checking the equality bool val = input1.Equals(input2); // checking the equivalency if (val == true) Console.WriteLine("input1 is equal to input2"); else Console.WriteLine("input1 is not equal to input2"); } } Output: input1 is not equal to input2 Note: This method implements the System.IEquatable<T> interface, and performs slightly better than Equals because it does not have to convert the obj parameter to an object.Reference: https://docs.microsoft.com/en-us/dotnet/api/system.boolean.equals?view=netframework-4.7.2#System_Boolean_Equals_System_Boolean_ Comment More infoAdvertise with us Next Article C# | Boolean.Equals(Boolean) Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp Boolean Struct Similar Reads C# | Boolean.CompareTo(Boolean) Method Boolean.CompareTo(Boolean) Method is used to compare the current instance to a specified Boolean object and returns an indication of their relative values. Syntax: public int CompareTo (bool value); Here, the value is a Boolean object to compare to the current instance. Return Value: This method ret 1 min read C# | Boolean.Equals(Object) Method Boolean.Equals(Object) Method is used to get a value which indicates whether the current instance is equal to a specified object or not. Syntax: public override bool Equals (object obj); Here, it takes an object to compare with the current instance. Return Value: This method returns true true if obj 2 min read C# | Byte.Equals(Byte) Method This method is used to return a value indicating whether this instance and a specified Byte object represent the same value. Syntax: public bool Equals (byte obj); Here, obj is a byte object to compare to this instance. Return Value: This method returns true if obj is equal to this instance otherwis 2 min read C# | Char.Equals() Method In C#, Char.Equals() is a System.Char struct method which is used to return a value by checking whether current instance is equal to a specified object or Char value. This method can be overloaded by passing different type of arguments to it. Char.Equals(Char) Method Char.Equals(Object) Method Char. 3 min read C# | Byte.Equals(Object) Method This method is used to get a value which indicates whether the current instance is equal to a specified object or not. Syntax: public override bool Equals (object obj); Here, it takes an object to compare with the current instance or null. Return Value: This method returns true if obj is an instance 2 min read Like