public GroupingViewAdapter( InputCollectionWrapper <TSource> source, LinqContinuousCollection <GroupedContinuousCollection <TKey, TElement> > output, Expression <Func <TSource, TKey> > keySelector, Expression <Func <TSource, TElement> > elementSelector, IEqualityComparer <TKey> comparer) : base(source, output, ExpressionPropertyAnalyzer.GetReferencedPropertyNames(keySelector)[typeof(TSource)]) { /* * : base(source, output, * ExpressionPropertyAnalyzer.GetReferencedPropertyNames(keySelector)[typeof(TSource)]. * */ if (elementSelector == null) { throw new ArgumentNullException("elementSelector"); } _keySelector = keySelector.Compile(); _elementSelector = elementSelector.Compile(); if (comparer == null) { comparer = EqualityComparer <TKey> .Default; } _comparer = comparer; foreach (TSource item in this.InputCollection) { AddItem(item, -1); } }
public SortingViewAdapter(InputCollectionWrapper <TSource> input, LinqContinuousCollection <TSource> output, Expression <Func <TSource, TKey> > keySelectorExpr, bool descending) : base(input, output, ExpressionPropertyAnalyzer.GetReferencedPropertyNames(keySelectorExpr)[typeof(TSource)]) { if (keySelectorExpr == null) { throw new ArgumentNullException("keySelectorExpr"); } _compareFunc = new FuncComparer <TSource, TKey>(keySelectorExpr.Compile(), descending); SetComparerChain(_compareFunc); FullSort(); // Because we do not know yet if we are last in chain. }
public SmartFilterAdapter( InputCollectionWrapper <T> input, LinqContinuousCollection <T> output, Expression <Func <T, bool> > predicateExpr) : base(input, output, ExpressionPropertyAnalyzer.GetReferencedPropertyNames(predicateExpr)[typeof(T)]) { _predicate = predicateExpr.Compile(); foreach (T item in input.InnerAsList) { if (_predicate(item)) { OutputCollection.Add(item); } } }