Set.elements Method [AX 2012]

Returns the number of elements in the set.

public int elements()

Run On

Called

Return Value

Type: int
The number of elements in the set.

The following example packs the contents of a set into a container. The elements method is used to test whether the set has any contents. If there are no contents, a nullNothingnullptrunita null reference (Nothing in Visual Basic) container is returned.

public static container intSet2Con(Set _intSet) 
{ 
    SetEnumerator se; 
    container     intCon; 
    ; 
 
    if (!_intSet || !_intSet.elements()) 
    { 
        return conNull(); 
    } 
    se = _intSet.getEnumerator(); 
    while (se.moveNext()) 
    { 
        intCon += se.current(); 
    } 
    return intCon; 
}

Reference

Community Additions

ADD
Show: