Question

My code :

decimal fAnzahlAktuell = 12;
decimal fMenge = 2;
decimal fAnzahlReserviertPickpos = 0;

decimal a = ((decimal)(fAnzahlAktuell - fAnzahlReserviertPickpos)) > fMenge ? fMenge : (decimal)(fAnzahlAktuell - fAnzahlReserviertPickpos);
decimal b = (decimal)((fAnzahlAktuell - fAnzahlReserviertPickpos) > fMenge ? fMenge : (decimal)(fAnzahlAktuell - fAnzahlReserviertPickpos));

When i compile using x86 -> a and b both = 2

When i compile using anycpu -> a = 2 and b = 0

Can anybody explain why?!

EDIT : I am using VS2010 , .NET 4.0 on Windows 7 x64

enter image description here

OTHER TIPS

It's a quirk of the debugger.

The mis-reported value that you are observing can only be seen in the debugger. If you output the values, for instance to the console, then you will see that they are both 2 for all configurations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top