I'm looking into code optimization of a project of mine and I was wondering how can I set an initial capacity to a SortedDictionary. I know that I can do it to a List and a Dictionary pretty easily in the constructor. But how can I do it to a SortedDictionary?
I thought about doing it like the code below, but I'm not sure if that works and how I could check it, once Dictionary has no capacity property (or has it?).
int capacity = 1000;
SortedDictionary<TKey, TValue> exampleSortedDictionary = new SortedDictionary<TKey, TValue>(new Dictionary<TKey, TValue>(capacity));