Boxing :- Boxing is an implicit conversion of a value type to the type object type
Consider the following declaration of a value-type variable:
int i = 123;
object o = (object) i;
UnBoxing :- 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
What is Value type and refernce type in .Net?.
Value Type : A variable of a value type always contains a value of that type. The assignment to a variable of a value type creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy of the reference but not of the referenced object.
The value types consist of two main categories:
* Stuct Type
* Enumeration Type
Reference Type :Variables of reference types, referred to as objects, store references to the actual data. This section introduces the following keywords used to declare reference types:
This section also introduces the following built-in reference types:
Please read all the post in the Dotnet Framework series.
Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )