Point.Equals 方法

定义

比较两个 Point 结构是否相等。Compares two Point structures for equality.

重载

Equals(Object)

确定指定的 Object 是否是 Point 以及它是否包含与此 Point 相同的坐标。Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point.

Equals(Point)

比较两个 Point 结构是否相等。Compares two Point structures for equality.

Equals(Point, Point)

比较两个 Point 结构是否相等。Compares two Point structures for equality.

Equals(Object)

确定指定的 Object 是否是 Point 以及它是否包含与此 Point 相同的坐标。Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point.

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

参数

o
Object

要比较的 ObjectThe Object to compare.

返回

如果 oPoint 并且包含与此 X 相同的 Y 值和 Point 值,则为 true;否则为 falsetrue if o is a Point and contains the same X and Y values as this Point; otherwise, false.

示例

下面的示例演示如何使用非静态Point Equals方法检查两个结构是否相等。The following example shows how to check if two Point structures are equal using the non-static Equals method.

private Boolean nonStaticEqualsExample()
{

    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Check if the two points are equal using the non-static Equals method.
    // areEqual is false
    Boolean areEqual = point1.Equals(point2);	

    return areEqual;

}

注解

Point使用Double值描述坐标。Point coordinates are described using Double values. 由于在上运算时Double , 的值可能会丢失精度, 因此, 逻辑Point上相等的两个值之间的比较可能会失败。Because the value of a Double can lose precision when operated upon, a comparison between two Point values that are logically equal might fail.

另请参阅

Equals(Point)

比较两个 Point 结构是否相等。Compares two Point structures for equality.

public:
 bool Equals(System::Windows::Point value);
public bool Equals (System.Windows.Point value);
override this.Equals : System.Windows.Point -> bool
Public Function Equals (value As Point) As Boolean

参数

value
Point

要与此实例进行比较的点。The point to compare to this instance.

返回

如果两个 Point 结构都包含相同的 X 值和 Y 值,则为 true;否则为 falsetrue if both Point structures contain the same X and Y values; otherwise, false.

注解

Point坐标使用Double值表示。Point coordinates are expressed using Double values. 由于在上运算时Double , 的值可能会丢失精度, 因此, 逻辑Point上相等的两个值之间的比较可能会失败。Because the value of a Double can lose precision when operated on, a comparison between two Point values that are logically equal might fail.

另请参阅

Equals(Point, Point)

比较两个 Point 结构是否相等。Compares two Point structures for equality.

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

参数

point1
Point

要比较的第一个点。The first point to compare.

point2
Point

要比较的第二个点。The second point to compare.

返回

如果 point1point2 包含相同的 XY 值,则为 true;否则为 falsetrue if point1 and point2 contain the same X and Y values; otherwise, false.

示例

下面的示例演示如何使用静态Point Equals方法检查两个结构是否相等。The following example shows how to check if two Point structures are equal using the static Equals method.

private Boolean staticEqualsExample()
{

    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Check if the two points are equal using the static Equals method.
    // areEqual is false
    Boolean areEqual = Point.Equals(point1, point2);

    return areEqual;

}

注解

使用Double值描述点坐标。Point coordinates are described using Double values. 由于在上运算时Double , 的值可能会丢失精度, 因此, 逻辑Point上相等的两个值之间的比较可能会失败。Because the value of a Double can lose precision when operated upon, a comparison between two Point values that are logically equal might fail.

另请参阅

适用于