Partilhar via


List.elements Method

Definition

Specifies the number of elements in a list.

public:
 int elements();
public int elements ();
member this.elements : unit -> int
Public Function elements () As Integer

Returns

The number of elements in the list.

Remarks

The following example creates a list of integers and adds some elements to it. The elements method is used to test whether there are three elements in the list.

{ 
    List il = new List(Types::Integer); 
    il.addStart(1); 
    il.addStart(2); 
    il.addStart(3); 
    if (il.elements() != 3) 
    { 
        print "Something is wrong..."; 
    } 
}

Applies to