The ToArray
extension method can only be used on IEnumerable
s. To transform an IEnumerable
, for example from your struct to a single value, you can use the Select
extension method.
var xValues = PostureList.Select(item => item.x).ToArray();
var yValues = PostureList.Select(item => item.y).ToArray();
var thetaValues = PostureList.Select(item => item.theta).ToArray();
You don't need to define the size of the arrays or create them with new
, the extension method will take care of that.