RSS

Concept of Boxing and Unboxing in .Net

11 Mar

Concept of Boxing and Unboxing

Boxing permits any value type to be implicitly converted to type object or to any interface type
implemented by value type. Boxing is a process in which  object  instances are created and copy
values in to that instance.
Unboxing is vice versa of boxing operation where the value is copied from the instance in to
appropriate storage location.
Below is sample code of boxing and unboxing where integer data type is converted in to object
and then vice versa.
Dim x As Integer
Dim y As Object
x = 10
‘ boxing process
y = x112
‘ unboxing process
x = y

Azhar Saiyed

Advertisements
 
Leave a comment

Posted by on March 11, 2011 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: