code more efficient for generic containers when they contain valuestype

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    code more efficient for generic containers when they contain valuestype

    Allegedly, they are more efficient than their non-generic counterparts
    because they avoid boxing.

    How is it possible to avoid boxing whenever generic code is used?
    Wouldn't autoboxing still require whenever open type is expended and
    used for value types as in the example below:

    List<intlist=ne w List<int>();

    list.Add(5); //Wouldn't this auto-box into Integer?

    Thanks
Working...