Point.Inequality(Point, Point) 演算子

定義

2 つの Point 構造体を比較し、等しくないかどうかを確認します。Compares two Point structures for inequality.

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

最初に比較するポイント。The first point to compare.

point2
Point

2 番目に比較するポイント。The second point to compare.

戻り値

Boolean

point1point2X 座標または Y 座標が異なる場合は truepoint1point2X 座標と Y 座標が同じ場合は falsetrue if point1 and point2 have different X or Y coordinates; false if point1 and point2 have the same X and Y coordinates.

次の例は、 Point オーバーロードされた (! =) 演算子を使用して、2つの構造体が等しくないかどうかを確認する方法を示しています。The following example shows how to check whether two Point structures are not equal, using the overloaded (!=) operator.

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 ます。A point's X and Y coordinates are described using Double values. Double値が有効な場合、値の精度が失われる可能性があるため、論理的に等しい2つの値の比較は Point 失敗する可能性があります。Because Double values can lose precision when operated on, a comparison between two Point values that are logically equal might fail.

適用対象