Only on my machine this happens. Basically if i run the following all is as expected:
double d = 500.22;
int i = (int)d;
Console.WriteLine(i.ToString());
Output is 500.
However if i put a breakpoint on the first line and step through, i always reverts to zero and the output is 0.
I've tested this on other machines and I cannot replicate, I've even reinstalled VS2010 and it still happens. So I'm thinking it must be some sort of environment setting that I have on my system, but I cannot figure out what.
Anyone else had this issue and how do I get rid of it.
Cheers.
EDIT: It appears that the issue is just with the 2nd line. If I put a break point on the 1st line and then just F5 over it, then it's all ok. But if I step into/over the 2nd line, the casting doesn't appear to work and i stays at 0.
I also tried setting i to 1 first and then seeing if the cast works, but it changes i back to 0 and removes my initial value of 1.
Here's a screenshot: