Difference b/w casting and boxing?

Answers were Sorted based on User's Feedback



Difference b/w casting and boxing?..

Answer / linton lazar

Boxing is converting a value type to a reference type
(Object Type).Casting is converting a reference type to a
reference type or a value type as another value type.
int i = 0;
object o = (object)i; //this is boxing
int i2 = (int)o; //this is unboxing.

long l = (long)i; //this is casting.

Is This Answer Correct ?    22 Yes 0 No

Difference b/w casting and boxing?..

Answer / anil kumar

Boxing is Converting to a value type to refrence type and
casting mean convert value type to a another value type.

int a;
object o=(object)a;(Boxing)

int a;
long b=a;(casting)

Is This Answer Correct ?    2 Yes 1 No

Difference b/w casting and boxing?..

Answer / kinjal panchal

Boxing:- Boxing is converting value type to Reference type.
for Example:-

int i=0;
object O=(object)i;

Casting:- Casting is converting value type to another value type
for example:-

int i=0;
long l=(long)i;

Is This Answer Correct ?    1 Yes 0 No

Difference b/w casting and boxing?..

Answer / anand gopal makwa munger

Boxing is the term for turning a value type (int, double, float, Guid, etc.) into a reference type (System.Object, System.String, etc.). Doing this boxing operation allocates memory on the heap (which the garbage collector will eventually need to reclaim).

Casting is taking a type (say, System.Object) and treating it as another type (say, System.String).

Is This Answer Correct ?    0 Yes 0 No

Difference b/w casting and boxing?..

Answer / sridevipc

casting converts value to reference type
boxing converts reference type to value type.



Is This Answer Correct ?    2 Yes 24 No

Post New Answer

More ASP.NET Interview Questions

Can One website be made using two different languages like c#,vb.net etc......

4 Answers   ABC,


What is SQL injection?

2 Answers  


What is a reflection?

0 Answers  


Suggest 3 best practices in detail for for Developing High Performance Web and Enterprise Applications

2 Answers   Techno Solutions,


How to manage different kinds of sessions in ASP.NET?

0 Answers   Cap Gemini,






In my code i have 3 tables,i have to insert 3 tables data using single insert query so that i wrote transations in a sp.but what my problem is,in those 3 tables i have to include my empId from another table.when i'm passing values im getting error at this EmpId. how can i solve this error to execute insert query? plesae tell me the solution...

1 Answers  


Define Query Interface,Adref,Release?

1 Answers   Microsoft,


Am not able to move the controls on the form freely in asp.net 3.5 even though I selected the position as relative or absolute for those controls. What should I do to overcome this?

0 Answers  


What does passport and windows authentication mean in ASP.NET?

0 Answers   Amdocs,


What is a windows service?

0 Answers  


can u debug application programatically? if yes how?

0 Answers   FactorH,


Give some salient points of difference between request processor and request dispatcher.

0 Answers   Tech Mahindra,


Categories