The behavior is well defined in C# and the evaluation order is:
- Left side
iis evaluated to the variablei - Right side is evaluated to 0, and
iis incremented (nowi==1) - The assignment is executed, it sets
ito 0. (nowi==0)
The end result is i==0.
In general you first create an expression tree. To evaluate it you evaluate first the left side, then the right side and finally the operation at the root. Do that recursively.