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.UnaryNegation Operator (Vector)


Negates the specified vector.

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

public static Vector operator -(
	Vector vector


Type: System.Windows.Vector

The vector to negate.

Return Value

Type: System.Windows.Vector

A vector with X and Y values opposite of the X and Y values of vector.

The following example shows how to use this negation operator to negate a Vector structure.

private Vector overloadedNegationOperatorExample()
    Vector vector1 = new Vector(20, 30);

    // Negate vector1 with the overloaded negation operator.
    // vectorResult is equal to (-20, -30).
    Vector vectorResult = -vector1;

    return vectorResult;


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