示例#1
0
        public void ForEach(Action <T> action, bool shouldStartFromHead = true)
        {
            ListNode currentNode = this.head;

            if (!shouldStartFromHead)
            {
                currentNode = this.tail;
            }

            while (currentNode != null)
            {
                action(currentNode.Value);

                if (!shouldStartFromHead)
                {
                    currentNode = currentNode.PreviousNode;
                }
                else
                {
                    currentNode = currentNode.NextNode;
                }
            }
        }
示例#2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DynamicList{T}" /> class.
 /// </summary>
 public DynamicList()
 {
     this.head  = null;
     this.tail  = null;
     this.Count = 0;
 }
示例#3
0
 /// <summary>
 /// Clears the DynamicList.
 /// </summary>
 public void Clear()
 {
     this.head  = null;
     this.tail  = null;
     this.Count = 0;
 }
 public ListNode(T element, ListNode prevNode)
 {
     this.Element      = element;
     prevNode.NextNode = this;
 }