Partilhar via


ListIterator.Next Method

Definition

Moves the iterator to the next element in the list.

public:
 virtual void Next();
public virtual void Next ();
abstract member Next : unit -> unit
override this.Next : unit -> unit
Public Overridable Sub Next ()

Remarks

Use the ListIterator.more method to determine whether the iterator points to a valid element.

The following example uses the ListIterator.next method to traverse a list as the value of each element is printed.

{ 
    List il = new List(Types::Integer); 
    ListIterator it; 
    int i; 
    // Add some elements 
    for (i = 1; i <= 10; i++) 
    { 
        il.addEnd(i); 
    } 
    // Traverse the list 
    it = new ListIterator(il); 
    while (it.more()) 
    { 
        print it.value(); 
        // Move to the next element 
        it.next();  
    } 
    pause; 
}

Applies to