There is a dictionary
ConcurrentDictionary<int, Man> Mans.
Man class:
protected class Man { protected string name; protected int age; }
All work with the dictionary in terms of receiving data is done through the int key of the dictionary (TryGetValue). When you add a new item to the dictionary, you need to sort it by the age field of the Man object. I know about SortedDictionary, but there the sorting takes place by key, and I need to do the same thing, only by the field of the Man object. It is important to sort it when adding, and not after the fact, since the amount of data is very large. Is there any way to do this?
SortedSet<Value>
apart and add to it when necessary? // Yeah, that's already suggested in the answer. - VladD