To tag an int, you need to create an object on the heap large enough to store all the data stored in the structure. Highlighting a new object on the heap means the GC works to find the spot, and works for the GC to clear / move it during and after its life. These operations, although not too expensive, are also not cheap.
To free up the value type, all you do is de-reference the pointer, so to speak. You just need to look at the link (this is what you have object) to find the location of the actual values. To look at a value in memory is very cheap, so this paragraph says that “unpacking” is cheap.
Update:
unboxed , . :
public struct MyStruct
{
private int value = 42;
public void Foo()
{
Console.WriteLine(value);
}
}
static void Main()
{
object obj = new MyStruct();
((MyStruct)obj).Foo();
}
MyStruct obj, , , . LIkewise / , . , . , , .