예제 #1
0
        internal override CachingComparer <TElement> GetComparer(CachingComparer <TElement>?childComparer)
        {
            CachingComparer <TElement> cmp = childComparer == null
                ? new CachingComparer <TElement, TKey>(_keySelector, _comparer, _descending)
                : new CachingComparerWithChild <TElement, TKey>(_keySelector, _comparer, _descending, childComparer);

            return(_parent != null?_parent.GetComparer(cmp) : cmp);
        }
예제 #2
0
 public CachingComparerWithChild(Func <TElement, TKey> keySelector, IComparer <TKey> comparer, bool descending, CachingComparer <TElement> child)
     : base(keySelector, comparer, descending)
 {
     _child = child;
 }
예제 #3
0
 public HackyHashSet(IEnumerable <T> coll, IEqualityComparer <T> comparer = null)
 {
     this.cachingComparer = new CachingComparer(comparer ?? EqualityComparer <T> .Default);
     this.set             = new HashSet <T>(coll, cachingComparer);
 }