Here is my code :
object w = 44;
var k1 = (w is double
? ((Convert.ToSingle(w)))
: ((unchecked((uint)Convert.ToInt64(w)))));
if (w is double)
{
w = 22;
}
The result is that k1
= 44.0 and w
== 44;
I wonder why the results is different!
Let's assume w
is double, in this case k1
should be 44.0 and w
should be 22.
Now let's assume w
is not double, in this case k1
should be 44 and w
should be 44.
What is the problem !?