示例#1
0
        public void AddLast(T x)
        {
            var toAdd = new Node2 <T>(x);

            if (head == null)
            {
                head = toAdd;
            }
            else
            {
                tail.Next      = toAdd;
                toAdd.Previous = tail;
            }
            tail = toAdd;
            Count++;
        }
示例#2
0
 public T this[int index]
 {
     get
     {
         Node2 <T> current = head;
         for (int i = 0; i != index && current != null; i++)
         {
             current = current.Next;
         }
         return(current.Value);
     }
     set
     {
         Node2 <T> current = head;
         for (int i = 0; i != index && current != null; i++)
         {
             current = current.Next;
         }
         current.Value = value;
     }
 }
示例#3
0
 public void Clear()
 {
     head  = null;
     tail  = null;
     Count = 0;
 }