What is Boxing and Unboxing?

Answer Posted / eduardo belmonte

Boxing is the process of converting value type to reference
type.

Unboxing is the process of converting from a reference type
to a value type.

Both are slow and should be avoided when possible or
unneeded.

Dim st AS String
Dim obj As Object
Dim n As Integer = 5
st = n ' Boxing happens
obj = n ' Boxing happens

n = st ' Unboxing happens
n = obj ' Unboxing happens

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we update records in gridview?Is there any appropriate code for it?

1814


How to display validation messages in one control?

727


List the types of authentication supported by asp.net?

704


What is Web API Routing?

791


What is the difference between the get method () and post method ()?

700


What is the difference between page directive include and action tag include?

698


How can you handle errors in Web API?

791


I’m having some trouble with cas. How can I diagnose my problem?

779


What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.

799


Can asp.net work on an nt server?

724


Explain asp.net page life cycle?

820


In What Order Do The Events Of An Aspx Page Execute. As A Developer Is It Important To Undertsand These Events?

779


Name some asp objects?

747


Write a code snippet to implement the indentation in json in web api.

765


What is the appSettings Section in the web.config file?

769