I stumbled across this while starting to learn about vars here:
http://msdn.microsoft.com/en-us/library/bb384061.aspx
However, I have no idea how that is a legal expression (it is). I thought you couldn’t assign to something using an a = (b=c) because (b=c) does not produce a value to assign?
Thanks for any clarification on the matter.
It is legal. From the = operator C# reference page:
(emphasis mine)
The code in the example is contrived (and pointless), but it can be used in other cases to do useful things in a more concise way. For example: