Multiple choice technology programming languages

What is boxing?

  1. Encapsulating an object in a value type.

  2. Encapsulating a copy of an object in a value type.

  3. Encapsulating a value type in an object.

  4. Encapsulating a copy of a value type in an object.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Boxing in .NET is the process of converting a value type (such as int or struct) to a reference type (object). When you box a value, the CLR creates a new object on the heap and copies the value type's contents into it. This is different from simply encapsulating an object (which is already a reference type).