Пример #1
0
        public void Remove(string value)
        {
            CloneProgram previous = null;
            CloneProgram current  = head;

            while (current != null)
            {
                if (current.Value.Equals(value))
                {
                    if (previous != null)
                    {
                        previous.Next = current.Next;
                        if (current.Next == null)
                        {
                            previous.Next = null;
                            tail          = previous;
                        }
                    }
                    else
                    {
                        head = current.Next;
                        if (head == null)
                        {
                            tail = null;
                        }
                    }
                    //break;
                }
                previous = current;
                current  = current.Next;
            }
        }
Пример #2
0
        public void Add(string value)
        {
            var item = new CloneProgram {
                Value = value
            };

            if (head == null)
            {
                tail = head = item;
            }
            else
            {
                tail.Next = item;
                tail      = item;
            }
        }