Map in Microsoft Dynamics Axapta

The map is used to index a value using a key value. Both the key and the value can be of any types specified in the Types enum.

 static void Collection_Map(Args _args)  
 // Create a new map with a key and value type  
 Map cars = new Map(Types::Integer, Types::String);  
 MapEnumerator mapE;  
 // Insert values to the map  
 cars.insert (1, "Volvo");  
 cars.insert (2, "BMW");  
 cars.insert (3, "Chrysler");  
 // Display the content of the map  
 info (cars.toString());  
 // Get the enumerator to loop  
 // through the elements of the map  
 mapE = cars.getEnumerator();  
 while (mapE.moveNext())  
 info(strfmt("Car %1: %2", mapE.currentKey(),