Decimal.UnaryNegation(Decimal) Decimal.UnaryNegation(Decimal) Decimal.UnaryNegation(Decimal) Decimal.UnaryNegation(Decimal) Operator

定義

將指定的 Decimal 運算元值變換正負號。Negates the value of the specified Decimal operand.

public:
 static System::Decimal operator -(System::Decimal d);
public static decimal operator - (decimal d);
static member ( ~- ) : decimal -> decimal
Public Shared Operator - (d As Decimal) As Decimal

參數

d
Decimal Decimal Decimal Decimal

要變換正負號的值。The value to negate.

傳回

d 乘以負一 (-1) 的乘積。The result of d multiplied by negative one (-1).

備註

方法會定義Decimal值的一元負運算子 (或加法反運算子) 的運算。 UnaryPlusThe UnaryPlus method defines the operation of the unary negation operator (or the additive inverse operator) for Decimal values. 作業會產生值, 使其在新增至原始數位時產生 0 (零)。The operation produces a value that results in 0 (zero) when it is added to the original number. 不支援自訂運算子的語言可以改為Negate呼叫方法。Languages that do not support custom operators can call the Negate method instead.

這個運算子的對等方法是Decimal.Negate(Decimal)The equivalent method for this operator is Decimal.Negate(Decimal)

適用於

另請參閱