Vector.UnaryNegation(Vector) 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的向量變換正負號。
public:
static System::Windows::Vector operator -(System::Windows::Vector vector);
public static System.Windows.Vector operator - (System.Windows.Vector vector);
static member ( ~- ) : System.Windows.Vector -> System.Windows.Vector
Public Shared Operator - (vector As Vector) As Vector
參數
- vector
- Vector
要變換正負號的向量。
傳回
X 和 Y 值與 vector
的 X 和 Y 值正負號相反的向量。
範例
下列範例示範如何使用這個負運算子來否定 Vector 結構。
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;
}
Private Function overloadedNegationOperatorExample() As Vector
Dim vector1 As New Vector(20, 30)
' Negate vector1 with the overloaded negation operator.
' vectorResult is equal to (-20, -30).
Dim vectorResult As Vector = -vector1
Return vectorResult
End Function