What is boxing and unboxing?

Entry C#

Answer

Boxing: value type → converted to object (heap)Unboxing: object → converted back to value type


int x = 10;object obj = x;        // boxingint y = (int)obj;      // unboxing

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice