MapEnumerator.currentKey Method

Returns the key from the (key, value) pair that is currently pointed to by the enumerator.

Syntax

public anytype currentKey()

Run On

Called

Return Value

Type: anytype
The key from the map element that is currently pointed to by the enumerator.

Remarks

You must call the MapEnumerator.moveNext method before you call the currentKey method.

Examples

The following example searches for a particular table ID in a map and then returns the key value of that map element.

private LabelType tableLabel(tableId _tableId) 
{ 
    LabelType     labelType; 
    MapEnumerator mapEnum; 
 
    mapEnum = tableAllMap.getEnumerator(); 
 
    while (mapEnum.moveNext()) 
    { 
        if (_tableId == mapEnum.currentValue()) 
        { 
            labelType = mapEnum.currentKey(); 
            break; 
        } 
    } 
    return labelType; 
}

See Also

MapEnumerator Class

MapEnumerator.currentValue Method