C♯相談室 Part3
■ このスレッドは過去ログ倉庫に格納されています
0232デフォルトの名無しさん
NGNGThe result of x++ or x-- is the value of x before the operation, whereas the result of ++x or --x is the value of x after the operation. In either case, x itself has the same value after the operation.
で、結果がどうしてこうなるのかは、参照型と値型の違いだけであって、postとstructの関係とか、preとclassの関係とかではない。
つまり、++cとc++は、おなじモノ参照してるけど、s++や++sのときにはその戻り値として新しい値ができてるわけ。だから別のものに操作を
加えていることになる。
■ このスレッドは過去ログ倉庫に格納されています