예제 #1
0
 public void AddLast(LinkedListNode <T> node)
 {
     VerifyBlankNode(node);
     if (first == null)
     {
         node.SelfReference(this);
         first = node;
     }
     else
     {
         node.InsertBetween(first.back, first, this);
     }
     count++;
     version++;
 }
예제 #2
0
        /// <summary>Adds the specified new node at the end of the <see cref="T:System.Collections.Generic.LinkedList`1" />.</summary>
        /// <param name="node">The new <see cref="T:System.Collections.Generic.LinkedListNode`1" /> to add at the end of 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" /> belongs to another <see cref="T:System.Collections.Generic.LinkedList`1" />.</exception>
        public void AddLast(LinkedListNode <T> node)
        {
            LinkedList <T> .VerifyBlankNode(node);

            if (this.first == null)
            {
                node.SelfReference(this);
                this.first = node;
            }
            else
            {
                node.InsertBetween(this.first.back, this.first, this);
            }
            this.count   += 1u;
            this.version += 1u;
        }