The +, - and NOT operators are named unary operators as they have a single operand.
unary-expression:
primary-expression
+ primary-expression
- primary-expression
Not primary-expression
For the Unary Plus operator of the +X form, a types extension is applied to select the specific standard implementation. Standard implementation is determined for the following operand types: Integer, UInte-ger, Long, ULong, Float, Double, Decimal. The result of this operator is simply the value of the operand.
For the Unary Minus operator of the -X form, a types extension is applied to select the specified standard implementation. The following standard implementations are determined:
Integer negation is determined for the types: Integer and Long. The result is calculated by subtracting the operand value from zero.
Floating-point negation is determined for the types: Float and Double. The result is operand value with its sign inverted. If the operand value is NaN, the result is also NaN.
Decimal negation is determined for the Decimal type. The result is calculated by subtracting the operand value from zero.
The Logical Negation operator of the Not X form is determined for Boolean-type operands. If the operand value is True, the operator result is False, and vice versa if the operand value is False, the result value is True.
See also: