Best data type for storing a list of strings?

In .NET, what data type do you use to store a list of strings?

I am currently using List(Of String)it because it’s easier than Arraymanaging and adding / removing things. I am trying to understand what other options are when they become convenient and when I should avoid using them List(Of String).

Are you using a different type? Why and when?

+3
source share
4 answers

List(Of String)A great way to store a list of strings. If you need to add / remove elements from the middle, you may need to use LinkedList(Of String), but for most situations Listthis is normal.

+4

System.Collections.Specialized.StringCollection is also an option, but personally, I prefer List (Of String).

+2
source

I think the name says it all really: in most cases List(Of String)- the best way to keep a list of strings.

+2
source

Source: https://habr.com/ru/post/1703561/


All Articles