Click to See Complete Forum and Search --> : Unboxing


davedwards
February 27th, 2003, 04:11 PM
I am having some problems unboxing and I'm not sure if I am doing something wrong or not.

When I attempt to unbox a short or char I get a NullReferenceException.

The following code will cause this error:

short x = 5;
Object * o = __box(x);
short y = *dynamic_cast<__box short *>(o);

In both C# and VB.Net there is no problem unboxing these types.

Any help would be appreciated.

Thanks, Dave