C# Extract the comma separated string to GET the List
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/480
It's been a long time since I've been using stupid methods like one-dimensional arrays. C# has always provided some very useful tips. This blog will tell you a very common way to get a list of characters composed of commas and strings.
C# Extract comma separated strings
string s = "11,222,3";
List<string> list = new List<string>(s.Split(','));
The result is
list [0] = 11; list [1] = 222, list [3] = 3
Take notes.
This article was last edited at 2020-10-20 17:31:15