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++; }
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; } }
public void Clear() { head = null; tail = null; Count = 0; }