Esempio n. 1
0
        IEnumerator <T> IEnumerable <T> .GetEnumerator()
        {
            LoopNode <T> current = Head;

            do
            {
                if (current != null)
                {
                    yield return(current.Data);

                    current = current.Next;
                }
            }while (current != Head);
        }
Esempio n. 2
0
        public void Add(T data)
        {
            LoopNode <T> node = new LoopNode <T>(data);

            // если список пуст
            if (Head == null)
            {
                Head      = node;
                Tail      = node;
                Tail.Next = Head;
            }
            else
            {
                node.Next = Head;
                Tail.Next = node;
                Tail      = node;
            }
            count++;
        }