Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


boxing means converting value type to reference type and
unboxing means converting reference type to value type.why
we need boxing and unboxing?

Answers were Sorted based on User's Feedback



boxing means converting value type to reference type and unboxing means converting reference type t..

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

boxing means converting value type to reference type and unboxing means converting reference type t..

Answer / madhu maaydi

some times super class ref is may not available to subclass objects at that time we may go for umboxing, data in the web application travers in the net throuw objects only but not through variables at that time we need to type cast it into equalent obecjt at this time we go for boxing and auto boximg....

Is This Answer Correct ?    0 Yes 0 No

boxing means converting value type to reference type and unboxing means converting reference type t..

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

More C Sharp Interview Questions

What is the use of inheritance in c#?

0 Answers  


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

0 Answers  


How can you overload a method?

3 Answers  


Explain the differences between static, void and public in c#?

0 Answers  


what are the Disadvantages of vb

0 Answers   Digital GlobalSoft,


What is private variable?

0 Answers  


Can var be null c#?

0 Answers  


What are the two keywords used to pass a variable by reference in c#?

2 Answers   IBM,


What is ienumerator c#?

0 Answers  


how to handle errors in sqlserver

1 Answers  


What is different between Static Constructor and Private Constructor?

0 Answers  


C Sharp

1 Answers   Wipro,


Categories