How to write boxing and unboxing program in c#

Posted by Jitendrasoft09 under C# on 6/26/2013 | Points: 10 | Views : 2051 | Status : [Member] [MVP] | Replies : 1
Hi All,
I want to understand How to write boxing and unboxing program in c#, let me know if anybody knows

Jitendra Kumar
If my post helps you, plz mark as an answer.


Posted by: Satyapriyanayak on: 6/26/2013 [Member] [MVP] Silver | Points: 25

Boxing permits any value type to be implicitly converted to type object or to any interface type
implemented by value type.Boxing is process in which a object instances created and copying
value types value 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 = x
' unboxing process
x = y

If this post helps you mark it as answer

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response