Example #1
0
        public IEnumerator GetEnumerator()
        {
            LinkListNode current = this.First;

            while (current != null)
            {
                yield return(current.Value);

                current = current.Next;
            }
        }
Example #2
0
        public LinkListNode Add(Object obj)
        {
            LinkListNode node = new LinkListNode(obj);

            if (First == null)
            {
                First = node;
                Last  = node;
            }
            //维护next和prev,直接前驱,直接后继
            else
            {
                LinkListNode lastNode = this.Last;
                this.Last.Next = node;
                this.Last      = node;
                node.Prev      = lastNode;
            }
            return(node);
        }