Partilhar via


MapEnumerator.currentValue Method

Definition

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

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

Returns

The value from the map element that is currently pointed to by the enumerator.

Remarks

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

The following example searches through a map to find an element that has a value equal to that passed in as a parameter. The MapEnumerator.moveNext method is used to iterate through the map, and the currentValue method is used to test each value to see whether it matches the parameter.

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