Vector.UnaryNegation(Vector) Operator

Definition

Negates the specified vector.

C#
public static System.Windows.Vector operator -(System.Windows.Vector vector);

Parameters

vector
Vector

The vector to negate.

Returns

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

Examples

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

C#
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;
}

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also