Boxing: This is the process of converting from value type to reference type.
Example int i = 67; // i is a value type object o = i; // i is boxed System.Console.WriteLine(i.ToString()); // i is boxed
UnBoxing: It’s the process of converting reference type to value type. System.Collections.ArrayList list = new System.Collections.ArrayList(); // list is a reference type int n = 67; // n is a value type list.Add(n); // n is boxed n = (int)list[0]; // list[0] is unboxed
Boxing: This is the process of converting from value type to reference type.
Example
int i = 67; // i is a value type
object o = i; // i is boxed
System.Console.WriteLine(i.ToString()); // i is boxed
UnBoxing: It’s the process of converting reference type to value type.
need an explanation for this answer? contact us directly to get an explanation for this answerSystem.Collections.ArrayList list = new System.Collections.ArrayList(); // list is a reference type
int n = 67; // n is a value type
list.Add(n); // n is boxed
n = (int)list[0]; // list[0] is unboxed