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

            e.Item = null;
            RaiseChangedEvent(e);
        }
コード例 #3
0
 public override object this[int index]
 {
     set
     {
         base[index] = value;
         ListWithChangedEventArgs e = new ListWithChangedEventArgs();
         RaiseChangedEvent(e);
     }
 }
コード例 #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);
        }
コード例 #5
0
 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");
     }
 }