1.

What is boxing and unboxing in .NET?

Answer»

Boxing is the process of converting a value type into a reference type directly. Boxing is implicit.

UNBOXING is the process where reference type is converted BACK into a value type. Unboxing is explicit.

An example is GIVEN below to demonstrate boxing and unboxing operations:

int a = 10; // a value typeobject o = a; // boxingint b = (int)o; // unboxing


Discussion

No Comment Found