public static void PrintLinkedList(NodeTest <T> node) { int counter = 1; while (node != null) { Console.WriteLine($"Node Number# { counter} is Equal to: {node.value}"); node = node.next; counter++; } }
public IEnumerator <T> GetEnumerator() { NodeTest <T> current = head; while (current != null) { yield return(current.value); current = current.next; } }
private void AddLast(NodeTest <T> nodeTest) { if (isEmpty) { head = nodeTest; } else { tail.next = nodeTest; } tail = nodeTest; Count++; }
private void AddFirst(NodeTest <T> nodeTest) { NodeTest <T> temp = head; head = nodeTest; head.next = temp; Count++; if (Count == 1) { tail = head; } }