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

What is the asp.net mvc folder conventions? : asp.net mvc

463


What are the advantages of asp.net?

539


What is content place holder?

524


What is the main difference between Asp.net and Vb.net?

564


Explain a program using razor view engine to create a simple application? : asp.net mvc

491






Define satellite assemblies.

584


what are the events raised in asp.net page life cycle?in which stage view state can be loaded?

547


What is different in .net 1.1 and .net 2.0?

572


What is bson in web api?

588


What is custom attribute?

569


Explain a program using code nuggets to create a simple application? : asp.net mvc

508


What are web server controls in asp.net?

548


What is paging in context of Memory?

648


Do session use cookies in asp net?

494


What describes a query?

525