Performance concern: StringCollection vs List

后端 未结 3 656
我在风中等你
我在风中等你 2021-02-01 14:37

I was wondering when I should use List< string > and when I should use StringCollection.

Let\'s say that I have to deal with large

3条回答
  •  猫巷女王i
    2021-02-01 14:52

    I would personally prefer to use List:

    • No need to remember one specific type just for strings
    • It implements the generic IEnumerable rather than just IEnumerable, and thus supports LINQ
    • It's supported in SilverLight
    • It's more idiomatic for most developers (IMO)

    I would be really surprised to find StringCollection to be significantly faster than List - see if you can back that up with numbers. My only cause for hesitation is that GridView could potentially have hard-coded support for StringCollection to make it fast with that type - but that sounds pretty unlikely to me.

提交回复
热议问题