What is boxing and unboxing in C#?

There are 2 sorts in c# one is esteem type and other is a reference type. The article is the base class of the considerable number of types in C#.

At the point when a worth sort is changed over into object type then this certain transformation process is called boxing. Then again when an item type is changed over back to its worth sort unequivocally then it is called as unpacking.


int a = 10;

/Here estimation of variable an is confined and allocated to variable o;

object o = a;

The estimation of article o should be unpacked at time of recovery.

int a =(int)o;

An express transformation is required while unpacking process.
What is boxing and unboxing in C#?

Leave a Comment

error: Alert: Content is protected!!