Пример #1
0
 private BidirectionalDictionary(int size, IEqualityComparer <TFirst> firstKeyComparer, IEqualityComparer <TSecond> secondKeyComparer, BidirectionalDictionary <TSecond, TFirst> reverse)
 {
     if (size > 0)
     {
         _buckets = new int[size];
         _entries = new Entry[size];
     }
     else
     {
         _buckets = HashHelpers.SizeOneIntArray;
         _entries = Array.Empty <Entry>();
     }
     if (firstKeyComparer != EqualityComparer <TFirst> .Default)
     {
         _comparer = firstKeyComparer;
     }
     if (reverse == null)
     {
         _shared  = new BidirectionalDictionaryShared();
         _reverse = new BidirectionalDictionary <TSecond, TFirst>(size, secondKeyComparer, firstKeyComparer, this);
     }
     else
     {
         _shared  = reverse._shared;
         _reverse = reverse;
     }
 }
Пример #2
0
 internal KeyCollection(BidirectionalDictionary <TFirst, TSecond> bidirectionalDictionary)
 {
     _bidirectionalDictionary = bidirectionalDictionary;
 }