Please note that C # does not comply with the BODMAS rule as you went to school. Suppose you have:
A().x = B() + C() * D();
You can naively believe that multiplication is done “first”, then addition, and assignment last, and therefore this is equivalent:
c = C();
d = D();
product = c * d;
b = B();
sum = b + product;
a = A();
a.x = sum;
, . BODMAS , ; .
# . , , :
a = A();
b = B();
c = C();
d = D();
product = c * d;
sum = b + product;
a.x = sum;
, # . :
A().x = B() + C() + D() * E();
:
a = A();
b = B();
c = C();
sum1 = b + c;
d = D();
e = E();
product = d * e;
sum2 = sum1 + product;
a.x = sum2;
., ; .
, " , , ". , :
A().x = ( ( B() + C() ) + ( D() * E() ) );
. - , , .
, . :
http://blogs.msdn.com/b/ericlippert/archive/tags/precedence/