Пример #1
0
 public MyCollection()
 {
     Last         = null;
     First        = null;
     Next         = null;
     CountInArray = 0;
 }
Пример #2
0
 public void Add(T item)
 {
     try
     {
         if (CountInArray == 100)
         {
             throw new Exception("слышь? Хватит уже");
         }
         if (First == null)
         {
             First = new NodeForMyCollection <T>(item);
             Last  = First;
             CountInArray++;
             Added?.Invoke("добавилось");
         }
         else
         {
             Last = new NodeForMyCollection <T>(item, Last);
             CountInArray++;
             Added("добавилось");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Пример #3
0
 public void Clear()
 {
     Last         = null;
     First        = null;
     CountInArray = 0;
     Cleared("очищено");
 }
Пример #4
0
 public void SetPrevious(NodeForMyCollection <T> objNext)
 {
     Previous = objNext;
 }
Пример #5
0
 public void SetNext(NodeForMyCollection <T> objNext)
 {
     Next = objNext;
 }
Пример #6
0
 public NodeForMyCollection(T objT, NodeForMyCollection <T> objT2)
 {
     Value = objT; Previous = objT2; Next = null;
     objT2.SetNext(this);
 }
Пример #7
0
 public NodeForMyCollection(T objT)
 {
     Value = objT; Previous = null; Next = null;
 }