Partilhar via


ListIterator.Delete Method

Definition

Removes the element that is pointed to by the iterator from the list.

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

Remarks

The iterator will point to the next element after the deletion.

The following example creates a list that contains three elements and prints a description of the elements in the list. It then deletes the first element in the list and prints a description of the remaining elements.

{ 
    List li = new List(Types::Integer); 
    ListIterator it; 
    li.addStart(1); 
    li.addStart(2); 
    li.addStart(3); 
    print li.toString(); 
    it = new ListIterator(li); 
    it.delete(); 
    print li.toString(); 
    pause; 
}

Applies to