Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SortedDictionary() [3/4]

System.Collections.Generic.SortedDictionary< TKey, TValue >.SortedDictionary ( IDictionary< TKey, TValue > dictionary,
IComparer< TKey >? comparer )
inline

Definition at line 606 of file SortedDictionary.cs.

607 {
608 if (dictionary == null)
609 {
610 throw new ArgumentNullException("dictionary");
611 }
612 KeyValuePairComparer keyValuePairComparer = new KeyValuePairComparer(comparer);
613 if (dictionary is SortedDictionary<TKey, TValue> sortedDictionary && sortedDictionary._set.Comparer is KeyValuePairComparer keyValuePairComparer2 && keyValuePairComparer2.keyComparer.Equals(keyValuePairComparer.keyComparer))
614 {
615 _set = new TreeSet<KeyValuePair<TKey, TValue>>(sortedDictionary._set, keyValuePairComparer);
616 return;
617 }
618 _set = new TreeSet<KeyValuePair<TKey, TValue>>(keyValuePairComparer);
619 foreach (KeyValuePair<TKey, TValue> item in dictionary)
620 {
621 _set.Add(item);
622 }
623 }
void Add(TKey key, TValue value)
readonly TreeSet< KeyValuePair< TKey, TValue > > _set

References System.Collections.Generic.SortedDictionary< TKey, TValue >._set, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.comparer, System.Collections.Generic.Dictionary< TKey, TValue >.Comparer, System.dictionary, and System.item.