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
Does c# support c type macros?
How can you read 3rd line from a text file?
What is xml serialization and deserialization in c#?
What is eager and lazy loading in c#?
What is the difference between ref & out parameters in c#?
Describe the difference between inline and code behind - which is best?
What is the property of class?
Explain the process of Serialization?
What are native functions?
What is difference between association, aggregation and inheritance relationships?
What is sqladapter c#?
Do we get an error while executing the “finally” block in c#?
Can we override static class in c#?
Why delegates are required?
What is the default boolean value in c#?