Your Ad Here

Friday, August 14, 2009

Boxing & UnBoxing in .Net

Boxing is implicit conversion of value types to reference types.
Recall that all classes and types are derived from the Object class. Because they are derived from Object class they can be implicitly converted to that type.
The following sample shows that:
Dim x as Integer=20 'declaring an integer x
Dim o as Object 'declaring an object
o=x 'converting integer to object
Unboxing is the conversion of a boxed value back to a value type.

No comments:

Post a Comment

Your Ad Here