[Solved] Why the usage of ++ is different in c#?


This:

newSequence = deduction.Sequence++;

Is equivalent to this:

newSequence = deduction.Sequence;
deduction.Sequence = deduction.Sequence + 1;

Make more sense now?

If you did this:

newSequence = ++deduction.Sequence;

It turns into this:

deduction.Sequence = deduction.Sequence + 1;
newSequence = deduction.Sequence;

As others have said, you are probably not looking to change deduction.Sequence, so you want to use this:

newSequence = deduction.Sequence + 1;

0

solved Why the usage of ++ is different in c#?