How to implement a multi-index dictionary?

前端 未结 11 1487
孤独总比滥情好
孤独总比滥情好 2020-12-14 00:32

Basically I want something like Dictionary, but not (as I\'ve seen here in other question) with the keys in AND, but in OR. To better explain: I

11条回答
  •  无人及你
    2020-12-14 01:05

    I have written such a dictionary and posted it on my blog. It will give you a nice API like this:

    DoubleKeyDictionary books = new DoubleKeyDictionary();
    bookListEx.Add(1, “21/12/2009″, “Lord of the Rings - Fellowship of the Ring”); 
    

    You can also do "Equals" on two dictionaries and for-each over it.

    Please note that there are at least one bug in the code (as discovered in the comments) and no unit tests etc. When (yeah!) I get some time I'll update the code with unit tests...

提交回复
热议问题