I have a dictionary of (string, integer). I need to order the dictionary by integer first, then use each integer value in a loop.
For instance, the dictionary contains cat 2, dog 1, rat 3…ordered would be dog 1, cat 2, rat 3. Then I would get the first value, 1, perform some functions with it, get the next value 2, perform some functions with it, and so on until the end of the dictionary.
So far I have:
Dim ordered = newdictionary.OrderBy(Function(x) x.Value)
ordered.Select(Function(x) x.Value)
What is a good way to accomplish this?
This seems to be what you actually want:
Now you’re looping the ordered
intvalues of the dictionaryDictionary<TKey, TValue>.ValuesPropertyEdit according to your comment you want to include the index to check if the next element equals the current: