语言

Point.Inequality(Point, Point) 操作员

定义

比较两 Point 个不相等结构。

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 op_Inequality : System.Windows.Point * System.Windows.Point -> bool
Public Shared Operator != (point1 As Point, point2 As Point) As Boolean

参数

point1
Point

要比较的第一个点。

point2
Point

要比较的第二个点。

返回

true 如果 point1 且 point2 具有不同的 X 或 Y 坐标, false 则为 if point1 和 point2 have the same X and Y coordinates.

示例

以下示例演示如何使用重载 (!=) 运算符检查两 Point 个结构是否不相等。

private Boolean overloadedInequalityOperatorExample()
{
    Point point1 = new Point(20, 30);
    Point point2 = new Point(45, 70);

    // Check whether the two Points are not equal, using the overloaded 
    // inequality operator.
    // areNotEqual is True.
    Boolean areNotEqual = (point1 != point2);

    return areNotEqual;
}
Private Function overloadedInequalityOperatorExample() As Boolean
    Dim point1 As New Point(20, 30)
    Dim point2 As New Point(45, 70)

    ' Check whether the two Points are not equal, using the overloaded 
    ' inequality operator.
    ' areNotEqual is True.
    Dim areNotEqual As Boolean = (point1 <> point2)

    Return areNotEqual

End Function

注解

使用值描述X点Y和Double坐标。 由于 Double 值在操作时可能会丢失精度,因此在逻辑上相等的两 Point 个值之间的比较可能会失败。

适用于