Point.Equality(Point, Point) Operador

Definición

Compara dos Point estructuras para obtener igualdad.

public:
 static bool operator ==(System::Windows::Point point1, System::Windows::Point point2);
public static bool operator ==(System.Windows.Point point1, System.Windows.Point point2);
static member ( = ) : System.Windows.Point * System.Windows.Point -> bool
Public Shared Operator == (point1 As Point, point2 As Point) As Boolean

Parámetros

point1
Point

Primera Point estructura que se va a comparar.

point2
Point

Segunda Point estructura que se va a comparar.

Devoluciones

true es si las X coordenadas y Y de point1 y point2 son iguales; de lo contrario, falsees .

Ejemplos

En el ejemplo siguiente se muestra cómo comprobar si dos Point estructuras son iguales mediante el operador sobrecargado (==).

private Boolean overloadedEqualityOperatorExample()
{
    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Check if two Points are equal using the overloaded equality operator.
    // areEqual is False.
    Boolean areEqual = (point1 == point2);

    return areEqual;
}
Private Function overloadedEqualityOperatorExample() As Boolean
    Dim point1 As New Point(10, 5)
    Dim point2 As New Point(15, 40)

    ' Check if two Points are equal using the overloaded equality operator.
    ' areEqual is False.
    Dim areEqual As Boolean = (point1 = point2)

    Return areEqual

End Function

Comentarios

Las coordenadas de un punto se describen mediante Double valores. Dado que el valor de Double puede perder precisión cuando se realizan operaciones aritméticas en ellos, puede producirse un error en una comparación entre dos Point valores que son lógicamente iguales.

Se aplica a

Consulte también