示例#1
0
 public SetProxy()
 {
     _added          = new ObserverSet <Action <T> >();
     _removed        = new ObserverSet <Action <T> >();
     _target         = null;
     _targetObserver = new Disposable();
 }
示例#2
0
        /// <summary>
        /// Create a new intersection set.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        public IntersectionSet(IReadonlyObservableSet <T> a, IReadonlyObservableSet <T> b)
        {
            _a       = a;
            _b       = b;
            _added   = new ObserverSet <Action <T> >();
            _removed = new ObserverSet <Action <T> >();
            _count   = 0;
            foreach (var item in a)
            {
                if (b.Contains(item))
                {
                    _count++;
                }
            }

            _aAddedObserver   = a.AddedWeak(AddedToA);
            _aRemovedObserver = a.RemovedWeak(RemovedFromA);
            _bAddedObserver   = b.AddedWeak(AddedToB);
            _bRemovedObserver = b.RemovedWeak(RemovedFromB);
        }
示例#3
0
 public Set()
 {
     _items   = new HashSet <T>();
     _added   = new ObserverSet <Action <T> >();
     _removed = new ObserverSet <Action <T> >();
 }