Boxing is the process of converting value type to the type object.Actually the copy of value type copied from stack to heap memory.
Unboxing is the process of converting obect type to value type.The value from heap memory back to stack memory.
int i = 123; // a value type
object o = i; // boxing
int j = (int)o; // unboxing
Value Types in .net are all numeric values (like int, double etc),Boolean,Char and Date,structures,Enumerations
Value Types stored on the stack.
Reference Types are String,Arrays even if their members are refernce types,classes and delegates.
Reference Types stored on the managed heap.
Home
Unboxing is the process of converting obect type to value type.The value from heap memory back to stack memory.
int i = 123; // a value type
object o = i; // boxing
int j = (int)o; // unboxing
Value Types in .net are all numeric values (like int, double etc),Boolean,Char and Date,structures,Enumerations
Value Types stored on the stack.
Reference Types are String,Arrays even if their members are refernce types,classes and delegates.
Reference Types stored on the managed heap.
Home
No comments:
Post a Comment