Possible Duplicate:
Explaining post-increment in C#
Consider the following C# code:-
int i = 2;
i = i++;
Console.WriteLine(i);
I am getting the output as 2. Why there is no effect of i = i++?
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.
Depending on where you put the
+-operators, the value assigned is incremented before or after:This way
iis counted up before assigned.This way
iis counted up after assigned.