Compartir a través de


Point3D.Equality(Point3D, Point3D) Operador

Definición

Compara dos estructuras Point3D para determinar si son iguales.

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

Parámetros

point1
Point3D

Primera estructura Point3D que se va a comparar.

point2
Point3D

Segunda estructura Point3D que se va a comparar.

Devoluciones

Boolean

Es true si las coordenadas X, Y y Z de point1 y point2 son iguales; en caso contrario, es false.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el operador de igualdad sobrecargado para comprobar si dos Point3D estructuras son iguales.

// Checks if two Point3Ds are equal using the overloaded equality operator.

Point3D point1 = new Point3D(10, 5, 1);
Point3D point2 = new Point3D(15, 40, 60);
Boolean areEqual;

areEqual = (point1 == point2);
// areEqual is False

// Displaying Results
syntaxString = "areEqual = (point1 == point2);";
resultType = "Boolean";
operationString = "Checking if two 3D points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
' Checks if two Point3Ds are equal using the overloaded equality operator.

Dim point1 As New Point3D(10, 5, 1)
Dim point2 As New Point3D(15, 40, 60)
Dim areEqual As Boolean

areEqual = (point1 = point2)
' areEqual is False

' Displaying Results
syntaxString = "areEqual = (point1 == point2)"
resultType = "Boolean"
operationString = "Checking if two 3D points are equal"
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString)

Comentarios

Dos Point3D estructuras son iguales si los valores de sus Xpropiedades , Y y Z son iguales.

Dado Double que los valores pueden perder precisión cuando se realizan operaciones aritméticas en ellos, es posible que se produzca un error en una comparación entre dos Point3D instancias que son lógicamente iguales.

Se aplica a

Consulte también