- 在C#中,操作数按
+
从左到右的顺序进行评估。 - 在C和C ++中,
+
未指定的操作数的求值顺序。
对于C#,您的示例工作如下:
y = x + x++; ^ x is 1 ^ x is increased to 2, but the postfix increment returns the old value (1) y = 2 y = x++ + x; ^ x becomes 2, but postfix increment returns the old value (1)^ x is now 2 here y = 3



