Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Monday, September 5, 2011

Enum Data Type Declaration in Microsoft Dynamics AX X++

Enums are represented in the AOT under Data Dictionary | Base Enums. You can use these enums in the code as a list of literals, as it is much more convenient to read and understand than a list of integers. Each enum can have maximum 251 literals. The first literal in an enum is indexed by the integer 0, the next one is indexed by 1, and so on; each of these integers represent a more understandable value, as shown in
the next example.
Here, you can see how you can assign an enum value to an enum variable of type Weekdays.
Weekdays day = Weekdays::Monday;
The value that is stored in the variable day will be the integer 1 since the enum Weekdays also has a value 0 that represents the enum "None", but it's a lot easier to read this code instead of the following that does the exact same thing:

Weekdays day = 1;

No comments:

Post a Comment

Archives