Collection requiring two keys to a unique value

前端 未结 2 1933
攒了一身酷
攒了一身酷 2021-01-27 06:10

I was wondering if anyone knew a good way to store data such that it would be indexed with two keys. Basically, I need something like a table (top-row is key1, left-column is k

相关标签:
2条回答
  • 2021-01-27 06:38

    I recommend:

    Dictionary<Tuple<int, int>, char>
    

    unless your table will be very large.

    0 讨论(0)
  • 2021-01-27 06:45

    If you're running .NET 4 you should look at the Tuple class.

    IDictionary<Tuple<K1, K2>, V> - This is the proper way to represent a 2-key dictionary.

    0 讨论(0)
提交回复
热议问题