C#C
C#3y ago
Jibz

❔ How do I check for an array key in Dictionary?

Dictionary<int[], int> test =
    new()
    {
        { new int[] { 2, 3 }, 3 }, // <- this one
        { new int[] { 3, 3 }, 6 },
        { new int[] { 3, 2 }, 3 }
    };

Console.WriteLine(test.ContainsKey(new int[] { 2, 3 }));

output:
False
Was this page helpful?