Ejemplo n.º 1
0
        public bool MoveNext()
        {
            // Конец списка
            if (current == null)
            {
                // Переход на начало коллекции
                Reset();
                return(false);
            }
            else
            {
                if (begin)
                {
                    begin = false;
                    return(true);
                }

                // Переход к следующему элементу коллекции
                current = current.Next;
                return(current != null);
            }
        }
Ejemplo n.º 2
0
 public T this[int index]
 {
     get
     {
         if (index == 0)
         {
             return(head.Item);
         }
         int position = 1;
         CustomListPoint <T> current = head;
         while (current.Next != null)
         {
             current = current.Next;
             if (index == position)
             {
                 return(current.Item); //возвращаем текущий элем
             }
             position++;
         }
         throw new IndexOutOfRangeException();
     }
     set => throw new NotImplementedException();
Ejemplo n.º 3
0
 public void Reset()
 {
     current = head;
     begin   = true;
 }
Ejemplo n.º 4
0
 public CustomEnumerator(CustomListPoint <T> head)
 {
     this.head    = head;
     this.current = head;
     this.begin   = true;
 }