Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#像PHP一样定义数组_C#_Arrays - Fatal编程技术网

C#像PHP一样定义数组

C#像PHP一样定义数组,c#,arrays,C#,Arrays,我有如下PHP数组代码: $waypoint = [ 10 => [ [80, 432], [320, 432], [1160, 432], ], 20 => [ [80, 432], [320, 432], [1160, 432], ], ]; 在C#中我该怎么做?也许你想要一个dictionary: var keyValues=新字典 { {10,新i

我有如下PHP数组代码:

$waypoint = [
    10 => [
        [80, 432],
        [320, 432],
        [1160, 432],
    ],
    20 => [
        [80, 432],
        [320, 432],
        [1160, 432],
    ],
];

在C#中我该怎么做?

也许你想要一个
dictionary

var keyValues=新字典
{
{10,新int[,]{80432},{320432},{1160432},
{20,新int[,]{80432},{320432},{1160432},
{30,新int[,]{80432},{320432},{1160432}
};

var keyValues = new Dictionary<int, int[,]>
{
    { 10, new int[,]{ { 80, 432 }, { 320, 432 }, { 1160, 432 } } },
    { 20, new int[,]{ { 80, 432 }, { 320, 432 }, { 1160, 432 } } },
    { 30, new int[,]{ { 80, 432 }, { 320, 432 }, { 1160, 432 } } }
};