Click here to Skip to main content
15,902,835 members
Home / Discussions / C#
   

C#

 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 9:17
mveDave Kreskowiak23-Sep-05 9:17 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts23-Sep-05 9:30
Wjousts23-Sep-05 9:30 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 16:58
mveDave Kreskowiak23-Sep-05 16:58 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts24-Sep-05 3:33
Wjousts24-Sep-05 3:33 
GeneralRe: Strange IL code from simple C# expression Pin
Daniel Grunwald24-Sep-05 21:44
Daniel Grunwald24-Sep-05 21:44 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak25-Sep-05 1:37
mveDave Kreskowiak25-Sep-05 1:37 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts25-Sep-05 3:29
Wjousts25-Sep-05 3:29 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak26-Sep-05 1:20
mveDave Kreskowiak26-Sep-05 1:20 
Wjousts wrote:
i++ is logically equavalent to i=i+1 correct?

No, it's not! i++; is equivilent to i=i+1. Your flaw is not understand the execution order of the operators and assignments you're using. This works like you want it to:
int i = 5;
i++;
Console.WriteLine(i.ToString());

You're not understanding the procedures, order, and times in which each operation takes place. It's already been explained to you in the C# Language Specifications.


Wjousts wrote:
Would you agree that the postfix or prefix notation doesn't change the output in this case?

It's not the operators that are changing the output. It's, again, the execution order and times of the operators in question. What do you think the output of these are?:
int i = 5;
Console.WriteLine((i++).ToString());
 
int i = 5;
Console.WriteLine((++i).ToString());



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: Strange IL code from simple C# expression Pin
Wjousts26-Sep-05 6:10
Wjousts26-Sep-05 6:10 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak26-Sep-05 13:57
mveDave Kreskowiak26-Sep-05 13:57 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts26-Sep-05 23:21
Wjousts26-Sep-05 23:21 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak27-Sep-05 14:25
mveDave Kreskowiak27-Sep-05 14:25 
GeneralRe: Strange IL code from simple C# expression Pin
Wjousts28-Sep-05 15:35
Wjousts28-Sep-05 15:35 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak29-Sep-05 0:29
mveDave Kreskowiak29-Sep-05 0:29 
GeneralRe: Strange IL code from simple C# expression Pin
Dave Kreskowiak23-Sep-05 7:46
mveDave Kreskowiak23-Sep-05 7:46 
QuestionMachine Names on Network Pin
Greeky22-Sep-05 23:11
Greeky22-Sep-05 23:11 
AnswerRe: Machine Names on Network Pin
enjoycrack23-Sep-05 1:22
enjoycrack23-Sep-05 1:22 
QuestionWeb Link in RichTextBox Pin
Greeky22-Sep-05 22:31
Greeky22-Sep-05 22:31 
AnswerRe: Web Link in RichTextBox Pin
enjoycrack23-Sep-05 1:25
enjoycrack23-Sep-05 1:25 
QuestionStraming integer values Pin
Afief22-Sep-05 22:22
Afief22-Sep-05 22:22 
QuestionMultiple Q's, Answer as many as you like. Pin
Anthony Mushrow22-Sep-05 22:07
professionalAnthony Mushrow22-Sep-05 22:07 
AnswerRe: Multiple Q's, Answer as many as you like. Pin
Niklas Ulvinge23-Sep-05 0:45
Niklas Ulvinge23-Sep-05 0:45 
QuestionCREATING AND DELETING DATABSE IN C# .NET Pin
EKJDBA22-Sep-05 22:05
EKJDBA22-Sep-05 22:05 
AnswerRe: CREATING AND DELETING DATABSE IN C# .NET Pin
sreejith ss nair23-Sep-05 2:19
sreejith ss nair23-Sep-05 2:19 
Questiondatagrid invoke and tablestyles Pin
xrado22-Sep-05 21:53
xrado22-Sep-05 21:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.