When would you not use Generic Collections?

前端 未结 8 1806
醉酒成梦
醉酒成梦 2021-01-19 00:57

The advantage of using generics is that it increases the type safety - you can only put in the correct type of thing, and you get out the correct type without requiring a ca

8条回答
  •  一整个雨季
    2021-01-19 01:33

    The main advantage is the is no boxing or unboxing penalty with generic collections of value types. This can be seen if you examine the il using ildasm.exe. The generic containers give better performance for value types and a smaller performance improvement for reference types.

提交回复
热议问题