public void AddFirst(T value) { var node = new MyDoubleNode <T>(value); node.Next = Root; if (Root != null) { Root.Prev = node; } Root = node; }
public void AddLast(T value) { var node = new MyDoubleNode <T>(value); if (Root == null) { Root = node; return; } var cur = Root; for (; cur.Next != null; cur = cur.Next) { continue; } cur.Next = node; node.Prev = cur; }
public MyDoubleNode(T value) { Value = value; Prev = Next = null; }