The problem is in the list <double [,]>
What is wrong with this (in C # 3.0):
List<double> x = new List<double> { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090, -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }; List<double> y = new List<double> { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023,0,0,0,0,0,0,0,0,0 }; List<double[,]> z = new List<double[,]>{x,y}; // this line An error has occurred:
Error: Argument '1': cannot convert from 'System.Collections.Generic.List<double>' to 'double[*,*]' Help needed.
var z = new List<List<double>> { x, y }; However, if you want to save your two lists in a two-dimensional array ([,]) this is your anders . You will have to convert it manually, as shown in the figure:
public static T[,] To2dArray(this List<List<T>> list) { if (list.Count == 0 || list[0].Count == 0) throw new ArgumentException("The list must have non-zero dimensions."); var result = new T[list.Count, list[0].Count]; for(int i = 0; i < list.Count; i++) { for(int j = 0; j < list.Count; j++) { if (list[i].Count != list[0].Count) throw new InvalidOperationException("The list cannot contain elements (lists) of different sizes."); result[i, j] = list[i][j]; } } return result; } The collection initializer for List<double[,]> expects elements of type double[,] (which is a two-dimensional array similar to a matrix), but you pass it x and y , which are of type List<double> , which means that it is trying add two doubling lists as elements of the new list.
If you are trying to add coordinates to the list, you need some kind of structure to contain them. You can write your own, or you can use System.Drawing.PointF .
Are you after something like this?
List<double> x = new List<double> { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090, -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }; List<double> y = new List<double> { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; List<double[]> z = x.Select((x1, index) => new double[2] {x1, y[index]} ).ToList(); EDIT: Modified my answer to correctly insert lists into the index, rather than looking for it.