This documentation is archived and is not being maintained.

Vector.op_UnaryNegation Method

Negates the specified vector.

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

public static Vector operator - (
	Vector vector
You cannot use methods in XAML.



The vector to negate.

Return Value

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;


Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0