public static INotifyValue <KeyValuePair <TItem, TKey>[]> CreateSelectorComparer(INotifyEnumerable <TItem> source, int x, Expression <Func <TItem, TKey> > selector, IComparer <TKey> comparer) { var ordered = new ObservableOrderBy <TItem, TKey>(source, selector, new ReverseComparer <TKey>(comparer)); var topx = new ObservableTopX <TItem, TKey>(ordered, x); topx.Successors.SetDummy(); return(topx); }
private ObservableTopX(ObservableOrderBy <TItem, TKey> source, int x) { this.source = source; X = x; value = new KeyValuePair <TItem, TKey> [0]; Successors.Attached += (obj, e) => Attach(); Successors.Detached += (obj, e) => Detach(); }