What is the cost SortedDictionary.Count in C #? Is it getting some kind of integer or is it doing it through the tree?
SortedDictionary.Count
It just returns the value from the field, so the cost should be negligible.
Per documentation
Retrieving the value of this property is an O (1) operation.
O (1) because it's just accessing the field.