is this a boxing or precedence problem?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

philipl_at_vistatec.ie
Date: 02/20/04


Date: 20 Feb 2004 04:07:25 -0800

hello, with the below code, i have been trying to figure for a while
whats causing this problem. Is this a problem or feature??

i know that j is incremented below with any temp variables but i uses
a temp var. why is i printed as 0? Is it because the one in the heap
is being referenced? If so why is this, as i thought values types are
kept in the stack?

thx for expertise.

                int i=0;
                int j=0;
                public box()
                {

                        Console.WriteLine(++j); //this will print j as 1

                        Console.WriteLine(i++); //this will print i as 0
                }