Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 14 Expressionsprevious at this levelnext at this level 14.6 Unary expressionsprevious at this levelnext at this level 14.6.2 Unary minus operator Paragraph 11 For an operation of the form -x, unary operator overload resolution (§14.2.3) is applied to select a specific operator implementation. 2 The operand is converted to the parameter type of the selected operator, and the type of the result is the return type of the operator. 3 The predefined negation operators are: Paragraph 21 The result is computed by subtracting x from zero. 2 In a checked context, if the value of x is the maximum negative int or long, a System.OverflowException is thrown. 3 In an unchecked context, if the value of x is the maximum negative int or long, the result is that same value and the overflow is not reported. 4 If the operand of the negation operator is of type uint, it is converted to type long, and the type of the result is long. 5 An exception is the rule that permits the int value −2147483648 (−231) to be written as a decimal integer literal (§9.4.4.2). 6 If the operand of the negation operator is of type ulong, a compile-time error occurs. 7 An exception is the rule that permits the long value −9223372036854775808 (−263) to be written as a decimal integer literal (§9.4.4.2). Paragraph 31 The result is the value of x with its sign inverted. 2 If x is NaN, the result is also NaN. Paragraph 41 The result is computed by subtracting x from zero. 2 Decimal negation is equivalent to using the unary minus operator of type System.Decimal.
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS