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.Subtract Method (Vector, Vector)


Subtracts the specified vector from another specified vector.

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

public static Vector Subtract(
	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 method to subtract a Vector structure from a Vector structure.

private Vector subtractExample()

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

    // Subtract vector2 from vector1.
    // vectorResult is equal to (-25, -40)
    Vector vectorResult = Vector.Subtract(vector1, vector2);

    return vectorResult;


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