Boxing and Unboxing - .NET

Describe Boxing and Unboxing.

Boxing
- It allows you to treat a value type the same as a reference type.
- It is used to store value types in the garbage-collected heap.
- It is an implicit conversion of a value type to the type object or to any interface type implemented by this value type.
- A value type allocates an object instance on the heap and copies the value into the new object.

Unboxing
- It converts a boxed reference type back to a value type.
- It is an explicit conversion from the type object to a value type or from an interface type to a value type that implements the interface.

An unboxing operation consists of:

1. Checking the object instance to make sure that it is a boxed value of the given value type.
2. Copying the value from the instance into the value-type variable.
What does WSDL stand for? Explain its purpose
ASP.NET - What does WSDL stand for? Explain its purpose....
Define ViewState in ASP.NET
ASP.NET - Define ViewState in ASP.NET - It allows the state of objects (serializable) to be stored in a hidden field on the page....
Lifespan for items stored in ViewState - ASP.NET
ASP.NET - Lifespan for items stored in ViewState - Items stored in the ViewState exist for the life of the current page.....
Post your comment