Point.Inequality(Point, Point) Operator

定義

2 つの 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

比較する 2 番目のポイント。

返品

true point1point2XまたはY座標が異なる場合はfalsepoint1point2XY座標が同じである場合は。

次の例は、オーバーロードされた (!=) 演算子を使用して、2 つの 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値を操作すると精度が失われる可能性があるため、論理的に等しい 2 つのPoint値の比較が失敗する可能性があります。

適用対象