public void Add(DoublyLinkedListNode <T> newNode) { if (head == null) { head = newNode; } else { var current = head; while (current != null && current.Next != null) { current = current.Next; } current.Next = newNode; newNode.Prev = current; newNode.Next = null; } }
public DoublyLinkedListNode(T data, DoublyLinkedListNode <T> prev, DoublyLinkedListNode <T> next) { this.Data = data; this.Prev = prev; this.Next = next; }
public DoublyLinkedListNode(T data) : this(data, null, null) { this.Data = data; this.Prev = null; this.Next = null; }