示例#1
0
        public T RemoveAt(int i)
        {
            T val;

            if (Set.TryRemove(i, out val))
            {
                DataStreamChanged.Invoke(this, new NotifyDataStreamChangedEventArgs <T>(i, NotifyCollectionChangedAction.Remove, val, default(T)));//this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, new KeyValuePair<int, T>(i, val)));
                return(val);
            }
            return(default(T));
        }
示例#2
0
 public T this[int i]
 {
     get
     {
         return(Set[i]);
     }
     set
     {
         if (!Set.ContainsKey(i))
         {
             Set[i] = value;
             DataStreamChanged.Invoke(this, new NotifyDataStreamChangedEventArgs <T>(i, NotifyCollectionChangedAction.Add, default(T), value));//this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, new KeyValuePair<int, T>(i, value)));
         }
         else if (!EqualityComparer <T> .Default.Equals(Set[i], value))
         {
             Set[i] = value;
             DataStreamChanged.Invoke(this, new NotifyDataStreamChangedEventArgs <T>(i, NotifyCollectionChangedAction.Replace, default(T), value));//(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, new KeyValuePair<int, T>(i, value)));
         }
     }
 }
示例#3
0
 private void DataStream_EntityChanged(IDataStream <Key> sender, DSChangedArgs <Key, T> args)
 {
     DataStreamChanged.Invoke(this, args);
 }
示例#4
0
 public void Clear()
 {
     Set.Clear();
     DataStreamChanged.Invoke(this, new NotifyDataStreamChangedEventArgs <T>(-1, NotifyCollectionChangedAction.Reset, default(T), default(T))); //this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
 }