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

Explain Apache web servers ? How can you get ASP.NET running in Apache web servers - why should you do this?

0 Answers   Siebel,


i develop a web application and i gave security setting i.e autherization and athentication now it work properly on my local system , now question is ,is this security setting ie autherization and athentication which i gave in web.config will it be enough strong to secure my application on internet or i have to use some 3rd party tool or software to get security .if yes --how ? if no--what is the alternate?

0 Answers  


What is the procedure to handle the process request using mhpm events fired? : asp.net mvc

0 Answers  


What is difference between View State and Hidden Field in ASP.NET?

0 Answers  


Give an example of cookie abuse.

0 Answers  






Can any one explain with the example how to capture the application error in Aplication_Error() method?

1 Answers   Infosys,


List the types of authentication supported by asp.net?

0 Answers  


To redirect the user to another page which method do we use without performing a round trip to the client?

0 Answers   Siebel,


What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

0 Answers   MindCracker,


How many types is controls is there in Asp.Net?If it means what are types of custom controls?Explain about user controls,Web server controls,Hrml server controls?

1 Answers   Cap Gemini, TCS,


Question asked by one of interviewer in panal is given below: We have 2 user control on same page ,1st user control contains textbox and a button while 2nd user control have label. when ever we click on button click of 1st custom control button the value of the textBox will get updated into Label of 2nd custom control. How to do this.Your help will be appreciated.

1 Answers  


Explain what are delegates?

0 Answers  


Categories