开发者

Array of tuple not working

this snippet of code

Tuple<int,double>[, ,] myArray = new Tuple<int, double> () [xsize, ysize, zsize];

returns this error

Cannot apply indexing with [] to an expression of type 'Tuple'

Where I'm using Tuple structure a开发者_高级运维s defined here.

Thank you for your help and many thanks to this website authors, this site helps me a lot for my day to day work.


I'm guessing that you want this:

Tuple<int,double>[, ,] myArray = new Tuple<int, double>[xsize, ysize, zsize];
                                                       ↑
                               note: removed the () ───┘


Creating an array is slightly different from creating any other object in that you don't specify an argument list for the constructor. Remove the () after the new Tuple<int, double> to fix your issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜