In C#, does anybody know why the following will compile:
int i = 1; ++i; i++;
but this will not compile?
int i = 1; ++i++;
(Compiler error: The operand of an increment or decrement operator must be a variable, property or indexer.)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you are running one of the operands on the result of the other, the result of a increment/decrement is a value – and you can not use increment/decrement on a value it has to be a variable that can be set.