I am able to sort my ConcurrentDictionary by value like so:
static ConcurrentDictionary<string, Proxy> Proxies =
new ConcurrentDictionary<string, Proxy>();
Proxies.OrderBy(p => p.Value.Speed);
Which is great, except I want to set that new re-ordered list AS the dictionary, effectively sorting the dictionary itself rather than just receiving a result list of sorted items.
I try to do something like this but had no luck - the dictionary is still unordered after:
Proxies = new ConcurrentDictionary<string,Proxy>(
Proxies.OrderBy(p => p.Value.Speed));
It seems like doing that has no effect on the dictionary. I also tried casting the OrderBy result to a new var thinking that it may have an effect on the delegate but still no luck.
How can I re-order this ConcurrentDictionary and then force the dictionary to be the re-ordered result from OrderBy?