Interview Questions

What is boxing?

ASP.NET and .NET WEB Questions and Answers


(Continued from previous question...)

What is boxing?

Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type object box = i; // Boxing
int j = (int)box; // Unboxing

(Continued on next question...)

Other Interview Questions