Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Operator precedence in C#

Operator precedence defines how an expression evaluates when several operators are present.
C# has specific rules that determine the order of evaluation.
The easiest one to remember is that multiplication and division happen before addition and subtraction.
Programmers often forget the other precedence rules,
so you should use parentheses to make the order of evaluation explicit.

For example:
  1. a = x + y - 2/2 + z;

The code has a very different meaning from the same statement with a particular grouping of parentheses:

  1. a = x + (y - 2)/(2 + z);


Points:
C# looks for parentheses to give high priority.
Then it looks for multiplication and division.
Then addition and subtraction.

If some operations have same priority, C# follows left to right execution.

..