I'm trying to get my head around the C# sorted collections such as SortedList and SortedDictionary. I have two main mental blockers and I can't find anywhere that explains them clearly. I understand that there is a default way in which these collections keep themselves sorted, and that you can also specify this.
I suppose my question is simply; How is this done? I can't find any simple examples of how to write these things.
Say for example I wanted a collection to store key value pairs from float to int, I want to be able to grab the int by querying the collection for the lowest float value. In other words I want to get the int with the lowest associated float key. Am I right in thinking that the fact that the collection is sorted makes it more efficient to do this kind of thing? Does this also mean that I can just grab the first element in the collection like: collection[0]? and it will be the lowest? (if i've sorted it that way)
Sorry this question is not more succinct, I'm just not sure where to start.