How does the CLR know the type of a boxed object?
- by fearofawhackplanet
When a value type is boxed, it is placed inside an untyped reference object.
So what causes the invalid cast exception here?
long l = 1;
object obj = (object)l;
double d = (double)obj;