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
How do I edit a dll file?
What is the difference between disposing of () and finalize() methods in c#?
What is the advantage of constructor?
Explain circular reference in c#?
What is xml document how do you open it?
What do you mean by for each loop?
What is the use of getcommandlineargs() method in c#.net?
What is winforms c#?
Describe ways of cleaning up objects in c#.
What is the size of a decimal?
Does c# support multiple inheritance (mi)?
Can we override constructor in c#?
Why would you use untrusted verification?
Why static variables are used?
What is the difference between static and private constructor in c#?