/// <summary> /// Create an enumerator on a linked list. /// </summary> /// <param name="head"> /// The head node for the list. /// </param> public LinkedListEnumerator(IListHead head) { #region Assert Debug.Assert( head != null, "Null list header", "A null list header was passed to the constructor." ); Debug.Assert( head.Next != null && head.Previous != null, "Null head reference", "The list header contains a null reference." ); #endregion this.head = head as ListNode; if (this.head == null) { throw new InvalidOperationException(); } this.list = head.Value as LinkedList; this.list.isIterating = true; this.node = this.head.next.previous; }
/// <summary> /// Create a node enumerator on a linked list that will /// start at the specified index. /// </summary> public NodeEnumerator(IListHead head, int index) : base(head, index) { }
/// <summary> /// Create a node enumerator on a linked list. /// </summary> public NodeEnumerator(IListHead head) : base(head) { }
/// <summary> /// Create an enumerator on a linked list that will /// start at the specified index. /// </summary> /// <param name="head"> /// Head node for the list. /// </param> /// <param name="index"> /// Position to which the enumerator will advance. /// </param> public LinkedListEnumerator(IListHead head, int index) : this(head) { this.MoveTo(index); }
/// <summary> /// Create a node enumerator on a linked list that will /// start at the specified index. /// </summary> public LinkedListIterator(IListHead head, int index) : base(head, index) { }
/// <summary> /// Create a node enumerator on a linked list. /// </summary> public LinkedListIterator(IListHead head) : base(head) { }