FAQ Database Discussion Community

Comparing values after ChangeType not working

I have the problem, that comparing values after changing the type (in this case to int) does not work: In my point of view (see the debugger), _pkValue and _defaultValue are both integers with the same value. The problem is, that the if-statement should not be entered, because both values...

c# - Convert.ChangeType() signed type

How to convert unsigned integer using the method Convert.ChangeType() if I want to get the number is less than zero ? Example uint l = 0xFFF0; short ret = (short)Convert.ChangeType(l, typeof(short)); // here error instead of -16 ...