Senior .Net Developer Question:

What is the difference between boxing and unboxing?

Tweet Share WhatsApp

Answer:

Boxing is the process of converting a value type to the type object, and unboxing is extracting the value type from the object. While the boxing is implicit, unboxing is explicit.

Example (written in C#):

int i = 13;
object myObject = i; // boxing
i = (int)myObject; // unboxing

Download Senior .Net Developer PDF Read All 60 Senior .Net Developer Questions
Previous QuestionNext Question
What is the difference between Task and Thread in .NET?What is deferred execution vs. immediate execution in LINQ?