You can organize the constants used in your code by creating a macro in the AOT for keeping all your constants in one place.
Also is a good idea if your macro is going to be used in several places so you will be able to reuse the macro.
To create a new macro in the AOT:
1. Click “Add” and “New Item”
2. Choose “macro” and call it “MyMacro”
3. Now insert the list of your macro inside the code like shown below)
#define.productCollection('productCollection')
#define.export('export')
4. Save the Macro, and it is ready to use.
To use the macro created in the AOT the macro command #macrolib is used.
Here the AOT macro is name MyMacro, and it can be used in the code as shown below.
static void testMacro(Args _args)
{
str test1, test2;
#macrolib.MyMacro //Declare the global Macro
test1 = #productCollection //Use the macro value defined inside
test2 = #export //Use the macro value defined inside
}
Comments
Post a Comment