Hi All, I want to know why below downcast fails @ run time:
case 1:
Object y = 10.23;
Console.WriteLine(y.GetType()); //System.Double
int z = (int)y;// fails @ runtime
Console.ReadKey();
case 2:
enter code here Double y = 10.23;
Console.WriteLine(y.GetType());//System.Double
int z = (int)y;//success
Console.ReadKey();
In both the cases the type of y is System.Double, still why downcst fails in first case?