public SelectReadOnlyContinuousCollection(IList <TSource> list, Expression <Func <TSource, TResult> > selectorExpression)
            : base(list, ExpressionPropertyAnalyzer.Analyze(selectorExpression))
        {
            this.SelectorFunction = selectorExpression.CachedCompile();

            this.CurrentValues = new Dictionary <TSource, TResult>(this.Source.Count);
            RecordCurrentValues(this.Source);

            if (this.NotifyCollectionChangedMonitor.IsMonitoringChildProperties)
            {
                this.SourceIndex = new ListIndexer <TSource>(this.Source);
            }

            this.NotifyCollectionChangedMonitor.Add         += OnAdd;
            this.NotifyCollectionChangedMonitor.Remove      += OnRemove;
            this.NotifyCollectionChangedMonitor.Reset       += OnReset;
            this.NotifyCollectionChangedMonitor.Move        += OnMove;
            this.NotifyCollectionChangedMonitor.Replace     += OnReplace;
            this.NotifyCollectionChangedMonitor.ItemChanged += OnItemChanged;
        }
Пример #2
0
 public static PropertyNotifier <T> Create <TResult>(Expression <Func <T, TResult> > expression)
 {
     return(new PropertyNotifier <T>(ExpressionPropertyAnalyzer.Analyze(expression)));
 }
 public static NotifyCollectionChangedMonitor <T> Create <TResult>(IList <T> input, Expression <Func <T, TResult> > expression)
 {
     return(new NotifyCollectionChangedMonitor <T>(ExpressionPropertyAnalyzer.Analyze(expression), input));
 }