# Vector Structure

**.NET Framework 4**

Represents a displacement in 2-D space.

**Namespace:**System.Windows

**Assembly:**WindowsBase (in WindowsBase.dll)

**XMLNS for XAML:**http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

The Vector type exposes the following members.

Name | Description | |
---|---|---|

Add(Vector, Point) | Translates the specified point by the specified vector and returns the resulting point. | |

Add(Vector, Vector) | Adds two vectors and returns the result as a Vector structure. | |

AngleBetween | Retrieves the angle, expressed in degrees, between the two specified vectors. | |

CrossProduct | Calculates the cross product of two vectors. | |

Determinant | Calculates the determinant of two vectors. | |

Divide | Divides the specified vector by the specified scalar and returns the result as a Vector. | |

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. (Overrides ValueType.Equals(Object).) | |

Equals(Vector) | Compares two vectors for equality. | |

Equals(Vector, Vector) | Compares the two specified vectors for equality. | |

Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |

GetHashCode | Returns the hash code for this vector. (Overrides ValueType.GetHashCode().) | |

GetType | Gets the Type of the current instance. (Inherited from Object.) | |

MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |

Multiply(Double, Vector) | Multiplies the specified scalar by the specified vector and returns the resulting Vector. | |

Multiply(Vector, Double) | Multiplies the specified vector by the specified scalar and returns the resulting Vector. | |

Multiply(Vector, Matrix) | Transforms the coordinate space of the specified vector using the specified Matrix. | |

Multiply(Vector, Vector) | Calculates the dot product of the two specified vectors and returns the result as a Double. | |

Negate | Negates this vector. The vector has the same magnitude as before, but its direction is now opposite. | |

Normalize | Normalizes this vector. | |

Parse | Converts a string representation of a vector into the equivalent Vector structure. | |

Subtract | Subtracts the specified vector from another specified vector. | |

ToString() | Returns the string representation of this Vector structure. (Overrides ValueType.ToString().) | |

ToString(IFormatProvider) | Returns the string representation of this Vector structure with the specified formatting information. |

Name | Description | |
---|---|---|

Addition(Vector, Point) | Translates a point by the specified vector and returns the resulting point. | |

Addition(Vector, Vector) | Adds two vectors and returns the result as a vector. | |

Division | Divides the specified vector by the specified scalar and returns the resulting vector. | |

Equality | Compares two vectors for equality. | |

Explicit(Vector to Point) | Creates a Point with the X and Y values of this vector. | |

Explicit(Vector to Size) | Creates a Size from the offsets of this vector. | |

Inequality | Compares two vectors for inequality. | |

Multiply(Double, Vector) | Multiplies the specified scalar by the specified vector and returns the resulting vector. | |

Multiply(Vector, Double) | Multiplies the specified vector by the specified scalar and returns the resulting vector. | |

Multiply(Vector, Matrix) | Transforms the coordinate space of the specified vector using the specified Matrix. | |

Multiply(Vector, Vector) | Calculates the dot product of the two specified vector structures and returns the result as a Double. | |

Subtraction | Subtracts one specified vector from another. | |

UnaryNegation | Negates the specified vector. |

Name | Description | |
---|---|---|

IFormattable.ToString | This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see ToString. |

A Point represents a fixed position, but a Vector represents a direction and a magnitude (for example, velocity or acceleration). Thus, the endpoints of a line segment are points but their difference is a vector; that is, the direction and length of that line segment.

In XAML, the delimiter between the X and Y values of a Vector can be either a comma or a space.

Some cultures might use the comma character as the decimal delimiter instead of the period character. XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. You should avoid using the comma character as the decimal delimiter if specifying a Vector in XAML, because that will clash with the string type conversion of a Vector attribute value into the X and Y components.

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.