-
Notifications
You must be signed in to change notification settings - Fork 35
Operators
Pedro Marques edited this page Aug 8, 2019
·
4 revisions
Expressions can be combined using operators. Each operator as a precedence priority. Here is the list of those expression's priority.
- primary
- unary
- multiplicative
- additive
- relational
- logical
These operators can do some logical comparison between other expressions: or, || and, &&
true or false and true
The and operator has more prioroty thand the or, thus in the example above, false and true is evaluated first.
=, ==, !=, <> <, <=, >, >=
1 < 2
+, -
1 + 2 - 3
*, /, %
1 * 2 % 3
& (bitwise and), | (bitwise or), ^(bitwise xor), << (left shift), >>(right shift)
2 >> 3
!, not, -, ~ (bitwise not)
not true
(, ) values
2 * ( 3 + 2 )
From v1.4.3, operations between decimal and floating point numbers convert the floating point number to a decimal. This may lead to a loss of precision as
Convert.ToDecimal(10e-30) == 0