How to split a string of an array of integers in List <int []>?
1 answer
Basic JavaScriptSerializer works for this:
using System.Web.Script.Serialization; string test = "[[0,2],[0,0],[0,0],[0,0],[0,0],[0,0]]"; var listOfInts = new JavaScriptSerializer() .Deserialize<int[][]>(test) .SelectMany(x => x).ToList(); var listOfArrays = new JavaScriptSerializer() .Deserialize<int[][]>(test) .Select(x => x).ToList(); Not sure if you need a list of arrays or a direct list of each number. So I gave both.
+2