語言

Decimal.UnaryNegation(Decimal) 運算子

定義

會抵消指定 Decimal 運算元的值。

public:
 static System::Decimal operator -(System::Decimal d);
public:
 static System::Decimal operator -(System::Decimal d) = System::Numerics::IUnaryNegationOperators<System::Decimal, System::Decimal>::op_UnaryNegation;
public static decimal operator -(decimal d);
static member ( ~- ) : decimal -> decimal
Public Shared Operator - (d As Decimal) As Decimal

參數

d
Decimal

要變換正負號的值。

傳回

結果乘 d 以負一(-1)。

實作

備註

此 UnaryPlus 方法定義了一元否定算子(或加法反算子)對值的 Decimal 運算。 這個運算產生的值,當它與原始數字相加時,會得到 0(0)。 不支援自訂運算子的語言則可直接呼叫該 Negate 方法。

此運算子的等價方法為 Decimal.Negate(Decimal)

適用於

另請參閱