How can string be transferred to the List?
-
Like such a line:
"[ [ [1],[2],[3] ], [ [4],[5],[6]] ]"
Put the same kind on the list?
-
If the line is always in such a format, regular expression can be used. For example:
using System.Text.RegularExpressions; // ... var s = "[ [ [1],[2],[3] ], [ [4],[5],[6]] ]"; var lst = Regex.Matches(s, "\\d+").Cast<Match>().Select(m => m.Value).ToList(); Console.WriteLine(String.Join(";", lst)); // 1,2,3,4,5,6
And if the line is different (and it appears to be JSON), then you should use JSON-Parser, for example. http://www.newtonsoft.com/json - is located in Microsoft Azure SDK (in the collection of Newtonsoft.Json.dll), it can also be downloaded as a separate package with https://www.nuget.org/packages/newtonsoft.json/ ♪