© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
13 replies
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 }));
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How do I check the length of an array when that array is null?
C#CC# / help
4y ago
❔ How do I get item values from an array?
C#CC# / help
3y ago
❔ Cant Find Key Type Byte In Dictionary?
C#CC# / help
3y ago