Exemple #1
0
 public virtual void RaiseChangedEvent(ListWithChangedEventArgs e)
 {
     if (Changed != null)
     {
         Changed.Invoke(this, e);
     }
 }
Exemple #2
0
        public override void Clear()
        {
            base.Clear();
            ListWithChangedEventArgs e = new ListWithChangedEventArgs();

            e.Item = null;
            RaiseChangedEvent(e);
        }
Exemple #3
0
 public override object this[int index]
 {
     set
     {
         base[index] = value;
         ListWithChangedEventArgs e = new ListWithChangedEventArgs();
         RaiseChangedEvent(e);
     }
 }
Exemple #4
0
        public override int Add(object value)
        {
            int i = base.Add(value);
            ListWithChangedEventArgs e = new ListWithChangedEventArgs();

            e.Index = i;
            e.Item  = value;
            RaiseChangedEvent(e);
            return(i);
        }
 private void List_Changed(object sender, ListWithChangedEventArgs e)
 {
     if (e.Item != null)
     {
         Console.WriteLine(e.Item + " inserted into list at index " + e.Index);
     }
     else
     {
         Console.WriteLine("List is cleared");
     }
 }