Why only boxed types can be unboxed?

 Posted by Charugoel on 2/4/2009 | Category: ASP.NET Interview questions | Views: 3542

Unboxing is the process of converting a Reference type variable to Value type and thus allocating memory on the stack . It happens only to those Reference type variables that have been earlier created by Boxing of a Value Type , therefore internally they contain a value type , which can be obtained through explicit casting . For any other Reference type , they don’t internally contain a Value type to Unboxed via explicit casting . This is why only boxed types can be unboxed.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response