Vector.Equals Vector.Equals Vector.Equals Vector.Equals Method

Definition

Compares two vectors for equality.

Overloads

Equals(Vector) Equals(Vector) Equals(Vector) Equals(Vector)

Compares two vectors for equality.

Equals(Vector, Vector) Equals(Vector, Vector) Equals(Vector, Vector) Equals(Vector, Vector)

Compares the two specified vectors for equality.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified Object is a Vector structure and, if it is, whether it has the same X and Y values as this vector.

Remarks

A vector's X and Y properties are described using Double values. 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(Vector) Equals(Vector) Equals(Vector) Equals(Vector)

Compares two vectors for equality.

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

Parameters

value
Vector Vector Vector Vector

The vector to compare with this vector.

Returns

true if value has the same X and Y values as this vector; otherwise, false.

Examples

The following example shows how to use this method to check whether two Vector structures are equal.

private Boolean equalsExample2()
{

    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(20, 30);
    Boolean areEqual = false;

    // areEqual is True.  Both parameters are Vector structures, 
    // and they are equal.
    if (vector1.Equals(vector2))
    {
        areEqual = true;
    }

    return areEqual;

}

Remarks

A vector's X and Y properties are described using Double values. Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Vector structures that are logically equal might fail.

See also

Equals(Vector, Vector) Equals(Vector, Vector) Equals(Vector, Vector) Equals(Vector, Vector)

Compares the two specified vectors for equality.

public:
 static bool Equals(System::Windows::Vector vector1, System::Windows::Vector vector2);
public static bool Equals (System.Windows.Vector vector1, System.Windows.Vector vector2);
static member Equals : System.Windows.Vector * System.Windows.Vector -> bool
Public Shared Function Equals (vector1 As Vector, vector2 As Vector) As Boolean

Parameters

vector1
Vector Vector Vector Vector

The first vector to compare.

vector2
Vector Vector Vector Vector

The second vector to compare.

Returns

true if t he X and Y components of vector1 and vector2 are equal; otherwise, false.

Examples

The following example shows how to use this method to check whether two Vector structures are equal.

private Boolean equalsExample1()
{

    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(20, 30);
    Boolean areEqual = false;

    // areEqual is True
    if (Vector.Equals(vector1, vector2))
    {
      areEqual = true;
    }

    return areEqual;

}

Remarks

A vector's X and Y properties are described using Double values. 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.

See also

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified Object is a Vector structure and, if it is, whether it has the same X and Y values as this vector.

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

Parameters

o
Object Object Object Object

The vector to compare.

Returns

true if o is a Vector and has the same X and Y values as this vector; otherwise, false.

Examples

The following example shows how to use this method to check whether a Vector and an Object are equal.

private Boolean equalsExample2()
{

    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(20, 30);
    Boolean areEqual = false;

    // areEqual is True.  Both parameters are Vector structures, 
    // and they are equal.
    if (vector1.Equals(vector2))
    {
        areEqual = true;
    }

    return areEqual;

}

Remarks

A vector's X and Y properties are described using Double values. Because the value of a Double can lose precision when arithmetic operations are performed on it, a comparison between two Vector structures that are logically equal might fail.

See also

Applies to