public static void Main() { NotifyingCollection watchable = new NotifyingCollection(10); watchable.CollectionChanged += new NotifyCollectionChangedEventHandler(watchable_CollectionChanged); watchable.Add(5); watchable.Add(8); watchable.Insert(0, 9); watchable.Remove(8); watchable.Add(11); Console.WriteLine("Current values:"); foreach (object i in watchable) { Console.WriteLine(i.ToString()); } Console.WriteLine(string.Empty); watchable.Clear(); //And the event handler… Thread.Sleep(Timeout.Infinite); }
public void RemoveEventRelayed() { Product first = new Product(); Product second = new Product(); NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second }; PagedEntityCollectionView<Product> view = new PagedEntityCollectionView<Product>(source); this.AssertCollectionChanged( () => source.Remove(first), view, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, first, 0), "when removing the first item."); }
public void RemoveEventRelayed() { Product first = new Product(); Product second = new Product(); NotifyingCollection <Product> source = new NotifyingCollection <Product>() { first, second }; PagedEntityCollectionView <Product> view = new PagedEntityCollectionView <Product>(source); this.AssertCollectionChanged( () => source.Remove(first), view, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, first, 0), "when removing the first item."); }