Share via


Map.keySet Method

Definition

Returns a set that contains the key values from a map.

public:
 Microsoft::Dynamics::Ax::Xpp::Set ^ keySet();
public Microsoft.Dynamics.Ax.Xpp.Set keySet ();
member this.keySet : unit -> Microsoft.Dynamics.Ax.Xpp.Set
Public Function keySet () As Set

Returns

Set

A set that contains the key values.

Remarks

The following example deletes all elements from a map that have key values that are not found as elements in a set.

public void deleteItems(Set _set, Map _map) 
{ 
    Set             deletedSet; 
    SetEnumerator   enumerator; 
    // deletedSet contains all key values from 
    // _map that are not values in _set 
    deletedSet = Set::difference(_map.keySet(), _set); 
    enumerator = deletedSet.getEnumerator(); 
    while (enumerator.moveNext()) 
    { 
        // Deletes elements from map with key 
        // values matching values in deletedSet 
        _map.remove(enumerator.current()); 
    } 
}

Applies to