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
What is data types in c#?
What is delegate in c#?
Is a decimal an integer?
What is the base class for array types?
What is difference between throw and throws in c#?
Why do we use public static void main in c#?
What is append in c#?
can you create a function in c# which can accept varying number of arguments
What is fcl in c#?
Why do we need collections in c#?
What is a partial method?
What does dbml mean in texting?
What is field in c#?
What does int parse do in c#?
How will you allow a class to be inherited, but prevent the method from being over-ridden?