What is boxing and unboxing ?

Answer Posted / kirti

Boxing :- Boxing is an implicit conversion of a value type to the type object type

Eg:-

Consider the following declaration of a value-type variable:

int i = 123;

object o = (object) i;

Boxing Conversion

UnBoxing :- Unboxing is an explicit conversion from the type object to a value type

Eg:

int i = 123; // A value type

object box = i; // Boxing

int j = (int)box; // Unboxing

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Will clr handle unmanaged code or not?

573


Explain how does assembly versioning in .net prevent dll hell?

549


Elaborate the term WebService and how it differ from Remoting?

564


What does manifest consists?

549


How can we call methods in remoting asynchronously?

519






Are you aware of containment and Aggregation ?

2696


What are dynamic assemblies?

573


What is a formatter in .net remoting?

582


What do you mean by windows authentication?

535


When should we choose .net remoting over .net web services?

542


What do you mean by passport authentication?

529


What are the types of remotable objects?

573


When do we use delegates in your remoting applications?

519


Explain the difference between the registerwellknownservicetype(), registerwellknownclienttype(), registeractivatedservicetype() and registeractivatedclienttype() in .net?

525


Name the distributed systems available apart from .net remoting?

563