How does the CLR know the type of a boxed object?

Posted by fearofawhackplanet on Stack Overflow See other posts from Stack Overflow or by fearofawhackplanet
Published on 2010-04-16T09:05:32Z Indexed on 2010/04/16 9:13 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

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;

© Stack Overflow or respective owner

Related posts about c#

Related posts about clr