Boxing and UnBoxing In C#

In this article we will learn about the Boxing and Unboxing concept in C# which most commonly asked question in the interview . So lets learn in brief and short so beginners and student can understand it .
What Is Boxing?
Converting value type to reference type is called as Boxing.The value converted with Boxing process stored into the heap. 
//value type 
int a=1;
//Value type to reference type
object B=a;

What Is Unboxing?
Converting reference type to value type is called as Unboxing . The value converted with Unboxing process stored into the stack. 
//reference type
object B=100;
//reference type to value type 
int a=(int)B;
Summary
I hope this article is useful for all readers. If you have a suggestion then please contact me.

Post a Comment

www.CodeNirvana.in

Protected by Copyscape
Copyright © Compilemode