共用方式為


Vector.Inequality(Vector, Vector) 運算子

定義

比較兩個向量是否不相等。

public:
 static bool operator !=(System::Windows::Vector vector1, System::Windows::Vector vector2);
public static bool operator != (System.Windows.Vector vector1, System.Windows.Vector vector2);
static member op_Inequality : System.Windows.Vector * System.Windows.Vector -> bool
Public Shared Operator != (vector1 As Vector, vector2 As Vector) As Boolean

參數

vector1
Vector

要比較的第一個向量。

vector2
Vector

要比較的第二個向量。

傳回

如果 vector1vector2XY 元件不同則為 true,否則為 false

範例

下列範例示範如何使用這個運算子 (!=) 來檢查兩 Vector 個結構是否不相等。

private Boolean overloadedInequalityOperatorExample()
{
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);
    Boolean areNotEqual;

    // Check whether the two Vectors are not equal, using the overloaded 
    // inequality operator.
    // areNotEqual is True.
    areNotEqual = (vector1 != vector2);

    return areNotEqual;
}
Private Function overloadedInequalityOperatorExample() As Boolean
    Dim vector1 As New Vector(20, 30)
    Dim vector2 As New Vector(45, 70)
    Dim areNotEqual As Boolean

    ' Check whether the two Vectors are not equal, using the overloaded 
    ' inequality operator.
    ' areNotEqual is True.
    areNotEqual = (vector1 <> vector2)

    Return areNotEqual

End Function

備註

向量的 XY 屬性會使用 Double 值來描述。 由於 的值 Double 可能會在算數運算上執行時失去精確度,因此邏輯上相等的兩 Vector 個結構之間的比較可能會失敗。

適用於