bool a = true; bool b = false; bool c = true; if (a.Equals(b)) // Returns false { Console.WriteLine("a and b are equal."); } else { Console.WriteLine("a and b are not equal."); } if (a.Equals(c)) // Returns true { Console.WriteLine("a and c are equal."); } else { Console.WriteLine("a and c are not equal."); }
bool a = true; object b = true; if (a.Equals(b)) // Returns true { Console.WriteLine("a and b are equal."); } else { Console.WriteLine("a and b are not equal."); }Package library: This method is part of the System namespace and can be found in the System.Runtime.dll file.