boxing means converting value type to reference type and
unboxing means converting reference type to value type.why
we need boxing and unboxing?
Answer Posted / uday
We use boxing and un-boxing when we assign a value to an
object and vice-versa.
Ex:
Int i=10;
Object o=i //this is boxing
int j=(int)o; //this is unboxing
When u say boxing, an object box is allocated and then the
value is copied to that box.
When u unbox, the value is copied out of the object box and
copied into storage location.
| Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Explain what is the smallest unit of execution in .net?
How Reflection is used and what it's significance ?
What is a callback c#?
Is unboxing an implicit conversion?
What is the difference between “constant” and “readonly” variables in c#?
What is the different types of private assembly and shared assembly?
What is the process of Serialization?
What is yield return in c#?
Why abstraction is used in c#?
How can I get the ascii code for a character in c#?
Explain the difference between the debug class and trace class?
What is the .net datatype that allows the retrieval of data by a unique key?
What is ac callback?
What is the difference between read and readline in c#?
When is a class declared as a class abstract?