Share via


MapEnumerator.currentKey Method

Definition

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

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

Returns

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.

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; 
}

Applies to