Partilhar via


MapIterator.value Method

Definition

Returns the value from the (key, value) pair that is referred to by the iterator.

public:
 virtual System::Object ^ value();
public virtual object value ();
abstract member value : unit -> obj
override this.value : unit -> obj
Public Overridable Function value () As Object

Returns

The value from the map element that is denoted by the map iterator.

Remarks

Use the MapIterator.more method to test whether an element exists before you try to retrieve the key value of the map element.

The following example iterates through a map and returns a list of all the elements in the map.

static str writeMap (Map m) 
{ 
    MapIterator it = new MapIterator(m); 
    str result; 
    while (it.more()) 
    { 
        result += it.key() + '\n' + it.value() + '\n'; 
        it.next(); 
    } 
    return result; 
}

Applies to