c# - Extract List<List<double> to list<double> -
am trying deserialise json below
[{"herelist":{"values":[[13.38,52.51],[13.428,52.523]]},"type":"double"}]
as following
public class herelist { public list<list<double>> values { get; set; } public string type { get; set; } }
can guide how extract values ([[a,b],[c,d]]) single list here.
tried thing
herelist ge = new herelist(); var x = ge.values; foreach(var val in x)//[13.38,52.51] { //pupulate list<double> //[13.38,52.51] }
use ienumerable<t>.selectmany
.
herelist ge = new herelist(); var allvalues = ge.values.selectmany(x => x).tolist();
Comments
Post a Comment