public bool MoveNext() { // Конец списка if (current == null) { // Переход на начало коллекции Reset(); return(false); } else { if (begin) { begin = false; return(true); } // Переход к следующему элементу коллекции current = current.Next; return(current != null); } }
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();
public void Reset() { current = head; begin = true; }
public CustomEnumerator(CustomListPoint <T> head) { this.head = head; this.current = head; this.begin = true; }