# Vector.Equals 方法

## 重载

 比较两个向量是否相等。Compares two vectors for equality. 比较两个指定向量是否相等。Compares the two specified vectors for equality. 确定指定的 Object 是不是 Vector 结构，如果是，则确定其是否与此向量具有相同的 X 和 Y 值。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.

## Equals(Vector)

``````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``

value
Vector

### 示例

``````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;

}
``````

## Equals(Vector, Vector)

``````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``

vector1
Vector

vector2
Vector

### 示例

``````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;

}
``````

## Equals(Object)

``````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

### 示例

``````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;

}
``````