Share via


List.addStart(Object) Method

Definition

Adds a value to the start of the list.

public:
 System::Object ^ addStart(System::Object ^ _element);
public object addStart (object _element);
member this.addStart : obj -> obj
Public Function addStart (_element As Object) As Object

Parameters

_element
Object

The value to add to the start of the list.

Returns

The value added to the list.

Remarks

Elements can be added to the end of the list by using the List.addEnd method.

The following example creates a list of integers, adds the values 1 and 2 to the end of the list, and then adds the value 3 to the start of the list. The values that are returned by the List.toString method are {3, 1, 2}.

{ 
    // Create a list of integers 
    list il = new List(Types::Integer); 
    // Add some elements to the list 
    il.addEnd(1); 
    il.addEnd(2); 
    il.addStart(3); 
    // Print a description of the list. 
    print il.definitionString(); 
    print il.toString(); 
    pause; 
}

Applies to