示例#1
0
        /// <summary>Removes all nodes from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
        public void Clear()
        {
            var next = _Head;

            while (next != null)
            {
                var linkedListNode = next;
                next = next.Next;
                linkedListNode.Invalidate();
            }
            _Head  = null;
            _Count = 0;
        }
示例#2
0
        /// <summary>Adds a new node containing the specified value at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
        /// <returns>The new <see cref="T:System.Collections.Generic.linked_list_node`1" /> containing <paramref name="value" />.</returns>
        /// <param name="value">The value to add at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
        public void Add(T value)
        {
            var node = new SimplyLinkedListNode <T>(value);

            if (_Head == null)
            {
                _Head = node;
            }
            else
            {
                var tmp = _Head;
                _Head      = node;
                node._Next = tmp;
            }
            _Count++;
        }
示例#3
0
 /// <summary>Removes the specified node from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
 /// <param name="node">The <see cref="T:System.Collections.Generic.linked_list_node`1" /> to remove from the <see cref="T:System.Collections.Generic.LinkedList`1" />.</param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="node" /> is null.</exception>
 /// <exception cref="T:System.InvalidOperationException">
 ///   <paramref name="node" /> is not in the current <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
 public void Remove(SimplyLinkedListNode <T> node)
 {
     throw (new NotImplementedException());
 }