.NET SortedDictionary But Sorted By Values

前端 未结 2 1868
我在风中等你
我在风中等你 2020-12-20 17:02

I need a data structure that acts like a SortedDictionary but is sorted based on the values rather than the keys. I need it to take about 1-

2条回答
  •  清酒与你
    2020-12-20 17:42

    The PowerCollections library has a class called OrderedMultiDictionary that is basically like a SortedDictionary but allows duplicates. When you lookup a key, you get an enumerable instead of a single value.

    The library is free and you should be able to do exactly what you want with that class - store the values as the keys.

提交回复
热议问题