Explaining post-increment in C# [duplicate]
Possible Duplicate: Behaviour and Order of evaluation in C# I have some code static void Main(string[] args) { int j = 0; for (int i = 0; i < 10; i++) j = j++; Console.WriteLine(j); } Why answer is 0 ? This is because of the way the ++ increment works . The order of operations is explained in this MSDN article This can be seen here (somebody please correct me if I am reading the spec on this one wrong :)): int j = 2; //Since these are value objects, these are two totally different objects now int intermediateValue = j; j = 2 + 1 //j is 3 at this point j = intermediateValue; //However j = 2 in