DrawingAttributes.Equals(Object) Método

Definición

Determina si el objeto especificado DrawingAttributes es igual al objeto actual DrawingAttributes .

public:
 override bool Equals(System::Object ^ o);
public override bool Equals(object o);
override this.Equals : obj -> bool
Public Overrides Function Equals (o As Object) As Boolean

Parámetros

o
Object

Objeto DrawingAttributes que se va a comparar con el objeto actual DrawingAttributes .

Devoluciones

true si los objetos son iguales; de lo contrario, false.

Ejemplos

En el ejemplo siguiente se comparan dos DrawingAttributes objetos para obtener igualdad. Dado que las Colorpropiedades StylusTip , Height, Widthy attributes1 de y attributes2 se establecen en los mismos valores, aparece el mensaje "The DrawingAttributes are equal".

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;
Dim attributes1 As New DrawingAttributes()
attributes1.Color = Colors.Blue
attributes1.StylusTip = StylusTip.Rectangle
attributes1.Height = 5
attributes1.Width = 5

Dim attributes2 As New DrawingAttributes()
attributes2.Color = Colors.Blue
attributes2.StylusTip = StylusTip.Rectangle
attributes2.Height = 5
attributes2.Width = 5
if (attributes1.Equals(attributes2))
{
    MessageBox.Show("The DrawingAttributes are equal");
}
else
{
    MessageBox.Show("The DrawingAttributes are not equal");
}
If attributes1.Equals(attributes2) Then
    MessageBox.Show("The DrawingAttributes are equal")
Else
    MessageBox.Show("The DrawingAttributes are not equal")
End If

Comentarios

Dos DrawingAttributes objetos son iguales si las siguientes propiedades son iguales:

Note

El Equals método no comprueba las propiedades personalizadas para obtener igualdad.

Se aplica a

Consulte también