Possible Duplicate:
Priority Queue in .Net
This question is similar, but I want to know for sure:
Is there any class / struct / ... in .Net for the priority queue? Like in STL, for this priority_queue. It supports comparsion function to support custom sorts.
The best I've found on .Net is a SortedList <Key, Value> , which sorts values by key. Thus, one solution is to implement the Compare user interface for the Key class. But I can’t split my elements into key / value pairs. I have atomic elements that should be queued according to their values using a special function.
So, is there any collection class in .Net that accepts a Compare function to sort its elements?
Is there a way to get a .Net class (possibly a HashSet ) that supports this feature?
Note:
- I know that many proponents have implemented really good classes for this. Perhaps a good example is PowerCollections . But I want a quick and easy solution using existing classes in .Net
- I am using .Net Framework 3.5 and as C #;)
Isaac source
share