C# | Boolean.Equals(Object) Method Last Updated : 23 Apr, 2019 Comments Improve Suggest changes Like Article Like Report 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 is a Boolean and has the same value as this instance otherwise, false. Below programs illustrate the use of the above-discussed method: Example 1: csharp // C# program to demonstrate the // Boolean.Equals(Object) Method using System; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 bool value1 = true; // Declaring and initializing value2 object value2 = 2 / 78; // using Equals(object) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: True is not equal to 0 Example 2: csharp // C# program to demonstrate the // Boolean.Equals(Object) Method using System; class GFG { // Main Method public static void Main() { // calling get() method get(true, 5); get(true, 4); get(false, false); get(true, true); } // defining get() method public static void get(bool value1, object value2) { // using Equals(object) method bool status = value1.Equals(value2); // checking the status if (status) Console.WriteLine("{0} is equal to {1}", value1, value2); else Console.WriteLine("{0} is not equal to {1}", value1, value2); } } Output: True is not equal to 5 True is not equal to 4 False is equal to False True is equal to True Reference: https://docs.microsoft.com/en-us/dotnet/api/system.boolean.equals?view=netframework-4.8#System_Boolean_Equals_System_Object_ Comment More infoAdvertise with us Next Article C# | Boolean.Equals(Object) Method K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Boolean-Struct Similar Reads 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 C# | Boolean.CompareTo(Object) Method Boolean.CompareTo(Object) Method is used to compare the current instance to a specified object and returns an integer which shows their relationship to one another. Syntax: public int CompareTo (object obj); Here, it takes an object to compare to current instance or null. Return Value: This method r 2 min read C# | Uri.Equals(Object) Method Uri.Equals(Object) Method is used to compare two Uri instances for equality. Syntax: public override bool Equals (object comparand); Here, it takes the Uri instance or a URI identifier to compare with the current instance. Return Value: This method returns a Boolean value true if the two instances r 2 min read C# | Boolean.Equals(Boolean) Method 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 2 min read C# | Boolean.Parse() Method This method is used to convert the specified string representation of a logical value to its Boolean equivalent. Syntax: public static bool Parse (string value); Here, the value is the string which contains the value to convert.Return Value: This method returns true if value is equivalent to TrueStr 3 min read Like