ListIterator.More Method

Definition

Determines whether the list iterator points to a valid element.

public:
 virtual bool More();
public virtual bool More ();
abstract member More : unit -> bool
override this.More : unit -> bool
Public Overridable Function More () As Boolean

Returns

true if the list iterator points to a valid element; otherwise, false.

Remarks

Attempting to access an element when this method returns false will cause an error.

The following example uses the ListIterator.more method to check whether there are more elements in the list and then runs through the while loop, which prints the values of all the elements in the list.

{ 
    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(); 
        it.next(); // Skip to the next element 
    } 
    pause; 
}

Applies to