When to use ArrayList over array[] in c#?

前端 未结 11 1754
别那么骄傲
别那么骄傲 2020-12-01 04:38

I often use an ArrayList instead of a \'normal\' array[].

I feel as if I am cheating (or being lazy) when I use an ArrayList,

11条回答
  •  [愿得一人]
    2020-12-01 05:10

    If you need an array of primitive types use Array for better performance as it will avoid autoboxing and unboxing. But only if you know the size you want ahead of time.

提交回复
热议问题