Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Vector.Subtraction Operator (Vector, Vector)


Subtracts one specified vector from another.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public static Vector operator -(
	Vector vector1,
	Vector vector2


Type: System.Windows.Vector

The vector from which vector2 is subtracted.

Type: System.Windows.Vector

The vector to subtract from vector1.

Return Value

Type: System.Windows.Vector

The difference between vector1 and vector2.

The following example shows how to use this operator (-) to subtract a Vector structure from a Vector structure.

private Vector overloadedSubtractionOperatorExample()
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);

    // Subtract vector2 from vector1 using the overloaded
    // "-" operator.
    // vector Result is equal to (-25, -40).
    Vector vectorResult = vector1 - vector2;

    return vectorResult;


.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft