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).
List(Of String)
Array
Are you using a different type? Why and when?
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.
LinkedList(Of String)
List
List<string> Dictionary<TKey, string>.
List<string>
Dictionary<TKey, string>
, , , .
IList<string> IDictionary<TKey, string>, , .
IList<string>
IDictionary<TKey, string>
System.Collections.Specialized.StringCollection is also an option, but personally, I prefer List (Of String).
I think the name says it all really: in most cases List(Of String)- the best way to keep a list of strings.
Source: https://habr.com/ru/post/1703561/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1703556/how-can-i-get-the-command-line-output-of-a-dos-tool-using-perl&usg=ALkJrhg1Ep_0nsIDYX15MiWDQdy8MOLHmgDoes changing the name of a variable throughout your code base just ask for disaster? - regexRewriteRule - a.php? A = 123 to / b / 123 - .htaccessHow to determine data string from xml in Xquery - xqueryКак заказать свойства в алфавитном порядке (Visual Studio 2008) - .netHow to draw a 3D border using visual styles? - c #.NET library for merging files - .netSvn and accented characters - svnCan a PHP script unserialize a stored file created using Perl? - phpPlatform Independent Parallel Programming Libraries for C ++ - c ++All Articles