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

前端 未结 11 1765
别那么骄傲
别那么骄傲 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:11

    Well for one, if you only intend to handle a specific type, you shouldn't use an ArrayList. For example, if you only expect an array of bytes, you should only accept an array of bytes.

    Only time I would think you may even think of using an ArrayList is instead of List.

提交回复
热议问题