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 / deepak

actually we need boxing and unboxing to keep more than one type of value type of variables in a common reference type of collection.. so that you can do the common operation in a loop or anywhere else.. by unboxing one by one.. also you can pass that collection to any method.. so you dont need to make many overloaded method for every type of value type..

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the Types of values mode can hold session state in web.config

546


What are the differences between a class and a struct?

473


We cannot create instances of static classes. Can we have constructors for static classes?

512


Is it possible to inline assembly or il in c# code?

523


What is an enumerator in c#?

518






What is static void main in c#?

498


What are custom exceptions in C#?

548


What is the interface in c#?

510


How to implement delegates in c#.net

545


Explain the 3 types of properties in c# with an example?

543


How to Show Message box in Metro Style App?

564


What is view state c#?

516


What is extension method in c sharp?

473


what is collections in .net? why we use?

1684


What is an array of arrays called?

430