I have a collection of Layers
where they have names and colors. What I want to do is to sort these first based on colors, then based on their names:
You could use the regular List
, but call the Sort()
method prior to displaying the list, and after new values are added. That should give you the functionality that you need. The performance will be good enough for this application.
Of course, you will have to define your own comparison for it to use, but that shouldn't be too much trouble.
If you don't have any hooks into the add event that can be used to sort the list, then you can wrap the list in a custom collection class as @Justin recommends.