Generics vs. Array Lists

后端 未结 12 1547
孤独总比滥情好
孤独总比滥情好 2020-12-10 12:19

The system I work on here was written before .net 2.0 and didn\'t have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to

12条回答
  •  甜味超标
    2020-12-10 12:55

    The only way to know for sure is to profile your code using a tool like dotTrace.

    http://www.jetbrains.com/profiler/

    It's possible that the boxing/unboxing is trivial in your particular application and wouldn't be worth refactoring. Going forward, you should still consider using generics due to the compile-time type safety.

提交回复
热议问题