简体   繁体   中英

C# List of arrays to array of arrays

I am new to C#. I am writing a program in which a list changes size depending on user input. The list is of GPS coordinates so it is

List<double[]> coordinates= new List<double[]>();

However I have a function that needs the GPS coordinates in double[][] format, an array of arrays. It seems like this would be very straightforward because it seems like a list of arrays is already an array of arrays. However, the most logical thing I can think to do fails:

double[][]test = new double[][]{};

test = coordinates.ToArray;

with "Cannot convert method group 'ToArray' to non-delegate type 'double[][]'. Did you intend to invoke the method?"

Not sure what that means or how to fix. Any advice is appreciated.

要在C#中调用方法,需要使用括号,如下所示: test = coordinates.ToArray();

你忘了括号:

double[][]test = coordinates.ToArray();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM