NET Boxing and
Unboxing - April 1, 2009 at 17:30
PM by Rajmeet Ghai
Explain Boxing and Unboxing in
.NET.
Boxing permits
any value type to be implicitly converted to type
object or to any interface type Implemented by value type. It
is the process of allocating an object instance and copying the value
type value into that instance.
E.g. Int I =10; A boxing conversion involves copying of the
value being boxed.
Boxing permits any value type to be explicitly converted to type
object or to any interface type Implemented by value type. It first
checks the object instance is a boxed value of the given value-type,
and then copying the value out of the instance.
E.g. Object box = 11; Int I = (int) box;
Also
read
CTS define how these different variables are declared and used in
run time...........
Manifest in .NET helps to understand the relation between
the elements of the assemblies...........
Garbage collection helps in releasing memory occupied by objects. CLR
automatically releases these unused objects...........
An Abstract class is only used for inheritance. This means it
acts as a base class for its derived
classes..............
Dispose method belongs to IDisposable interface. It is used
to free unmanaged resources like files, network connection
etc.............. | |