pmt9
pmt9

Reputation: 51

C# define array like PHP

I have PHP array code like this:

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

How can I do in C#?

Upvotes: 1

Views: 50

Answers (1)

StepUp
StepUp

Reputation: 38094

Maybe you want a Dicitionary<TKey, TValue>:

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 } } }
};

Read more about Dictionary<TKey, TValue>

Upvotes: 2

Related Questions