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

Explain the namespace classes used in asp.net mvc? : asp.net mvc

501


Explain the differences between clr & cts?

564


What is runat?

617


What is request and response in asp.net?

513


Describe Segmentation With Paging?

632






What is httpresponse?

516


When using the Pager object, inorder to know which page to go, which property you have to set to grid?

565


How can we apply themes to an asp.net application?

562


What are url fragments?

508


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

536


Define the types of configuration files.

534


What is difference between or and orelse?

551


What is the difference between session and viewstate in asp.net?

610


Explain the disadvantages of viewstate?

573


How does http session work?

522