Does c# have any statements which don't follow left to right evaluation order?
c#, language-design
Solution
Assignment is (sort of) right to left:
int a = b + c;
b+c gets evaluated, then assigned to a.
In general, though, the C# designers have purposely tried to keep most things left->right. A great example is LINQ. Here, instead of going with the traditional SQL ordering (SELECT XXX FROM XXX), they purposely reordered the query to be more left->right.
// Note the left->right ordering:
var results = from member in collection where member.element == condition select member;
// Which is equivelent to:
var resultsNonLinq = collection.Where().Select();
This is part of why I like C# - the consistency in the language is very refreshing, especially when compared to some languages like perl where there is purposely many ways of doing simple things.
Problem
An idle question on language design, see "Does C# have a right hand if like Perl". For example, in recent C family languages ``` z = foo ( a, b, c ); ``` `a` is evaluated, then `b`, then `c`, so left-to-right. ``` z = a ? b : c; ``` `a` is evaluated, then either `b` or `c`, so left-to-right order. In Python, you write a conditional expression as ``` z = b if a else c ``` so the order is the same - `a`,then `b` or `c`, but it's not left-to-right. Strict left-to-right ordering was put into Java to simplify the language; ordering is implementation dependent in C or C++.