Rectangle rect1 = new Rectangle(10,10,20,30); Rectangle rect2 = new Rectangle(10,10,20,30); if (rect1.Equals(rect2)) { Console.WriteLine("The rectangles are equal"); } else { Console.WriteLine("The rectangles are not equal"); }
Rectangle rect1 = new Rectangle(10,10,20,30); Rectangle rect2 = new Rectangle(20,20,10,20); if (rect1.Equals(rect2)) { Console.WriteLine("The rectangles are equal"); } else { Console.WriteLine("The rectangles are not equal"); }Output: The rectangles are not equal The package library for the System.Drawing Rectangle class is the .NET Framework Class Library.
Tests whether obj is a
public Equals ( object obj ) : bool | ||
obj | object | |
return | bool |