Why do we need boxing and unboxing in C#?

I know what boxing and unboxing is, but I can’t comprehend the real use of it. Why and where should I use it?

short s = 25;

object objshort = s;  //Boxing

short anothershort = (short)objshort;  //Unboxing

12 Answers
12

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *