A. x += y
is just shorthand for x = x + y
, the compiler always expands it out as such
https://msdn.microsoft.com/en-us/library/sa7629ew.aspx
B. C# isn’t like math where you can rearrange an equation as you wish. As such, you can’t have an expression such as a+b
on the lefthand side of an assignment, which is what the =
does. How would you store the value of c
in a+b
? it just isn’t logical so this is the clear wrong answer. In programming, =
does not have the same meaning as an equals sign in a mathematical equation.
https://msdn.microsoft.com/en-us/library/sbkb459w.aspx
solved Which of the following arithmetic expressions is identical to the expression a += b * c [closed]