While playing around with the ++
operator, I tried to write the following:
++i++;
I expected this to compile at first, but I got a compiler error:
The operand of an increment or decrement operator must be a variable, property or indexer.
I then tried writing ++(i++)
to help the compiler understand what I meant but it also (unsurprisingly) didn't work.
So I am left wondering what does the ++
operator return ? With the compiler error I am getting I was expecting ++i
to not return an int
representing the value of i
incremented, but that is also not the case since I can do i = (++i) + 1
with success...
Anybody have any idea why the ++
operator cannot be chained ?
Also, (++i).GetType()
does return System.Int32
.