List.pack Method

Serializes the current instance of the List class.

Syntax

public container pack()

Run On

Called

Return Value

Type: container
A container that contains the current instance of the List class.

Remarks

The container created by this method contains 3 elements before the first element from the list:

  • A version number for the container

  • An integer that identifies the data type of the list elements

  • The number of elements in the list

If the elements in the list are objects, packing is performed by calling the pack method successively on each object to yield a subcontainer. The list can be retrieved from the packed container by using the List.create method.

Examples

The following example creates a list of records and passes in the packed list as a parameter for creating a new projReverseMarking object.

public boolean canClose() 
{ 
    ProjReverseMarking      projReverseMarking; 
    boolean                 canClose; 
    List                    list; 
 
    canClose = super(); 
    if (element.closedOk() && canClose) 
    { 
        List = new List(Types::Record); 
        while select tmpFrmVirtualLines 
        { 
            list.addEnd(tmpFrmVirtualLines); 
        } 
        projReverseMarking = new ProjReverseMarking(list.pack()); 
        projReverseMarking.run(); 
    } 
    return canClose; 
}

See Also

List Class

List::create Method

Pack-Unpack Design Pattern