DrawingAttributes.Equals(Object) Method

Definition

Determines whether the specified DrawingAttributes object is equal to the current DrawingAttributes object.

C#
public override bool Equals(object o);

Parameters

o
Object

The DrawingAttributes object to compare to the current DrawingAttributes object.

Returns

true if the objects are equal; otherwise, false.

Examples

The following example compares two DrawingAttributes objects for equality. Because the Color, StylusTip, Height, and Width properties on attributes1 and attributes2 are set to the same values, the "The DrawingAttributes are equal" message appears.

C#
DrawingAttributes attributes1 = new DrawingAttributes();
attributes1.Color = Colors.Blue;
attributes1.StylusTip = StylusTip.Rectangle;
attributes1.Height = 5;
attributes1.Width = 5;

DrawingAttributes attributes2 = new DrawingAttributes();
attributes2.Color = Colors.Blue;
attributes2.StylusTip = StylusTip.Rectangle;
attributes2.Height = 5;
attributes2.Width = 5;
C#
if (attributes1.Equals(attributes2))
{
    MessageBox.Show("The DrawingAttributes are equal");
}
else
{
    MessageBox.Show("The DrawingAttributes are not equal");
}

Remarks

Two DrawingAttributes objects are equal if the following properties are equal:

Note

The Equals method does not check the custom properties for equality.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also