Microsoft Dynamics AX 2012 R3 Development-3 Locus IT Services

Microsoft Dynamics AX 2012 R3 Development-3

Locus IT ServicesMicrosoft Dynamics AX 2012 R3 Development-3

Lesson 1 : Collection Classes

Collection Classes

X++ contains two compound data types: arrays and containers. They are useful for aggregating values of simpler data types. However, you cannot store objects in arrays or containers. The Microsoft Dynamics AX collection classes have been designed for storing objects.

The following collection classes are available:

  • List
  • Map
  • Set
  • Array
  • Struct

The following are aggregating data:

  • RecordSortedList
  • RecordInsertList

We cannot store objects in arrays (x++ class) or containers. In AX it has been designed for storing objects.

Below are Set , Map , List , Array

Set is used for the storage and retrieval of data from a collections in which the members are unique. The values of the members serve as the key according to which the data is automatically ordered. Thus, it differs from a List where the members are placed into a specific position, and not ordered Automatically by their value.

Collection Classes

The collection classes are shown in the following table.

Class  Description
Array Similar to the X++ language array type except that it can hold values of any single type, including objects and records. Objects are accessed in a specific order.

For more information, see X++, C# Comparison: Array Syntax.

List Contains elements that are accessed sequentially.

Unlike the Array class, the List class provides an addStart method.

As with the Set class, the List class provides methods getEnumerator and getIterator. You can use an iterator to insert and delete items from a List object.

Map Associates a key value with another value.
Set Holds values of any single type. Values are not stored in the sequence they are added. Instead, the Set object stores them in a manner that optimizes performance for the in method.

When you add a value to a Set object which is already storing that same value, the add attempt is ignored by the Set object.

Unlike the Array class, the Set class provides the methods in and remove.

Struct Can contain values of more than one type. Used to group information about a specific entity.
Locus IT Project Management Office
What’s it?