boxing means converting value type to reference type and
unboxing means converting reference type to value type.why
we need boxing and unboxing?
Answer Posted / uday
We use boxing and un-boxing when we assign a value to an
object and vice-versa.
Ex:
Int i=10;
Object o=i //this is boxing
int j=(int)o; //this is unboxing
When u say boxing, an object box is allocated and then the
value is copied to that box.
When u unbox, the value is copied out of the object box and
copied into storage location.
| Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
How does inheritance work in c#?
How many parameters can a method have c#?
How to create multi-dimensional array?
What is sorted list in c#?
If you donot specify an access modifier for a method, what is the default access modifier?
Is null == null c#?
What is bitwise operator in c#?
What are the problem with .NET generics?
How a two-dimensional array declared in C#?
What is difference between events and delegates?
What are delegates and why are they required?
How can we sort the elements of the array in descending order?
Describe an abstract class?
What are custom attributes in c#?
What is cookies in c# asp net?