Composite Data Types

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The composite data types in X++ are listed in the following table. For more information about each data type, click its link.

X++ composite data types

Description

Arrays

An array is a list of items with the same data type and the same name—only the index differs.

Containers

A container is a dynamic list of items containing primitive data types and/or some composite data types.

Classes as Data Types

A class is a type definition that describes both variables and methods for instances (objects) of the class.

Delegates as data types

A delegate collects methods that subscribe to the delegate. The delegate specifies the parameter signature that all its subscriber methods must share. When the delegate is called, the delegate calls each of its subscribers.

Tables as Data Types

All tables defined in the database can be handled as class definitions.

The Collection classes allow you to create arrays, lists, sets, maps, and structs that can hold any data type, including objects.

Default Values on Composite Types

The default values for variables of composite data types are shown in the following table.

Data type

Default

Description

Array

as data type

The default value on an array is that all items have their normal default value.

Container

empty

The default value of a container is empty. The container does not contain any values.

Class

null

A class is only a definition for objects, and all objects are null when they are declared.

Delegate

not applicable

No delegate can have a default value. However, each delegate starts with zero methods subscribed to it.

Table

empty

A table variable can be seen as an instance (an object) of the table (class) definition. For every field in a table variable, the default value is empty.

See also

Extended Data Types (EDTs)

Primitive Data Types

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.