P
philipl
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
}
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
}