what is difference between string array and list of string in c#

前端 未结 5 1589
旧巷少年郎
旧巷少年郎 2020-12-08 02:00

I hear on MSDN that an array is faster than a collection.

Can you tell me how string[] is faster then List.

5条回答
  •  醉酒成梦
    2020-12-08 02:52

    The article is from 2004, that means it's about .net 1.1 and there was no generics. Array vs collection performance actually was a problem back then because collection types caused a lot of exta boxing-unboxing operations. But since .net 2.0, where generics was introduced, difference in performance almost gone.

提交回复
热议问题