Пример #1
0
 // ReSharper disable once AnnotationConflictInHierarchy
 public void Add([NotNull] T item)
 {
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     myStorage.Add(item);
     myChange.Fire(ListEvent <T> .Add(myStorage.Count - 1, item));
 }
Пример #2
0
        // ReSharper disable once AnnotationConflictInHierarchy
        public void Insert(int index, [NotNull] T item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            myStorage.Insert(index, item);
            myChange.Fire(ListEvent <T> .Add(index, item));
        }
Пример #3
0
 public void Advise(Lifetime lifetime, Action <ListEvent <T> > handler)
 {
     for (int index = 0; index < myStorage.Count; index++)
     {
         try
         {
             handler(ListEvent <T> .Add(index, myStorage[index]));
         }
         catch (Exception e)
         {
             Log.Root.Error(e);
         }
     }
     myChange.Advise(lifetime, handler);
 }