Matrix.Equals 方法

定義

判斷兩個指定的 Matrix 結構是否具有相同的值。Determines whether the two specified Matrix structures have the same values.

多載

Equals(Object)

判斷所指定 ObjectMatrix 結構是否與這個 Matrix 相同。Determines whether the specified Object is a Matrix structure that is identical to this Matrix.

Equals(Matrix)

判斷指定的 Matrix 結構是否與這個執行個體相同。Determines whether the specified Matrix structure is identical to this instance.

Equals(Matrix, Matrix)

判斷兩個指定的 Matrix 結構是否相同。Determines whether the two specified Matrix structures are identical.

範例

下列範例顯示如何檢查兩個 Matrix 結構是否相等。The following example shows how to check two Matrix structures for equality.

private void equalityExample()
{

    Matrix matrix1 = new Matrix(5, 10, 15, 20, 25, 30);
    Matrix matrix2 = new Matrix(5, 10, 15, 20, 25, 30);
    
    Boolean result;
    
    // result is true.
    result = (matrix1 == matrix2);            
    
    // result is false.
    result = (matrix1 != matrix2);
}

備註

注意

會將 Matrix 其值儲存為雙精度浮點數。A Matrix stores its values as doubles. 因為的值在 Double 執行算數運算時可能會遺失精確度,所以在邏輯上相等的兩個結構之間的比較 Double 可能會失敗。Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Double structures that are logically equal might fail.

Equals(Object)

判斷所指定 ObjectMatrix 結構是否與這個 Matrix 相同。Determines whether the specified Object is a Matrix structure that is identical to this Matrix.

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.

傳回

Boolean

如果 oMatrix 結構與這個 Matrix 結構相同則為 true,否則為 falsetrue if o is a Matrix structure that is identical to this Matrix structure; otherwise, false.

範例

下列範例顯示如何檢查兩個 Matrix 結構是否相等。The following example shows how to check two Matrix structures for equality.

private void equalityExample()
{

    Matrix matrix1 = new Matrix(5, 10, 15, 20, 25, 30);
    Matrix matrix2 = new Matrix(5, 10, 15, 20, 25, 30);
    
    Boolean result;
    
    // result is true.
    result = (matrix1 == matrix2);            
    
    // result is false.
    result = (matrix1 != matrix2);
}

備註

注意

會將 Matrix 其值儲存為雙精度浮點數。A Matrix stores its values as doubles. 因為的值在 Double 執行算數運算時可能會遺失精確度,所以在邏輯上相等的兩個結構之間的比較 Double 可能會失敗。Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Double structures that are logically equal might fail.

另請參閱

適用於

Equals(Matrix)

判斷指定的 Matrix 結構是否與這個執行個體相同。Determines whether the specified Matrix structure is identical to this instance.

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

參數

value
Matrix

要與這個執行個體 (Instance) 比較的 Matrix 執行個體。The instance of Matrix to compare to this instance.

傳回

Boolean

如果執行個體相等,則為 true,否則為 falsetrue if instances are equal; otherwise, false.

範例

下列範例顯示如何檢查兩個 Matrix 結構是否相等。The following example shows how to check two Matrix structures for equality.

private void equalityExample()
{

    Matrix matrix1 = new Matrix(5, 10, 15, 20, 25, 30);
    Matrix matrix2 = new Matrix(5, 10, 15, 20, 25, 30);
    
    Boolean result;
    
    // result is true.
    result = (matrix1 == matrix2);            
    
    // result is false.
    result = (matrix1 != matrix2);
}

備註

注意

會將 Matrix 其值儲存為雙精度浮點數。A Matrix stores its values as doubles. 因為的值在 Double 執行算數運算時可能會遺失精確度,所以在邏輯上相等的兩個結構之間的比較 Double 可能會失敗。Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Double structures that are logically equal might fail.

另請參閱

適用於

Equals(Matrix, Matrix)

判斷兩個指定的 Matrix 結構是否相同。Determines whether the two specified Matrix structures are identical.

public:
 static bool Equals(System::Windows::Media::Matrix matrix1, System::Windows::Media::Matrix matrix2);
public static bool Equals (System.Windows.Media.Matrix matrix1, System.Windows.Media.Matrix matrix2);
static member Equals : System.Windows.Media.Matrix * System.Windows.Media.Matrix -> bool
Public Shared Function Equals (matrix1 As Matrix, matrix2 As Matrix) As Boolean

參數

matrix1
Matrix

要比較的第一個 Matrix 結構。The first Matrix structure to compare.

matrix2
Matrix

要比較的第二個 Matrix 結構。The second Matrix structure to compare.

傳回

Boolean

如果 matrix1matrix2 相同則為 true,否則為 falsetrue if matrix1 and matrix2 are identical; otherwise, false.

備註

注意

會將 Matrix 其值儲存為雙精度浮點數。A Matrix stores its values as doubles. 因為的值在 Double 執行算數運算時可能會遺失精確度,所以在邏輯上相等的兩個結構之間的比較 Double 可能會失敗。Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Double structures that are logically equal might fail.

另請參閱

適用於