As you might know there are a lot of controls and related macro commands in the WHS classes. It is not really convenient to search for macro commands in code, since they are not supported by the cross-reference feature.
In D365 Finance and Operations, there is an option that can help simplify the development of warehouse mobile flows and tracking using the existing commands. It is constants.
In my opinion, the best example of the mentioned option is the "ProcessGuideDataTypeNames" class. Inside the class you can find a lot of constants that are used in the mobile device flows.
As you can see, macros are used at the class declaration level, but with a specific reference to a value in the WHSRF macro. As a result, you can use cross-references to find all the places in the code where the constants are used.
- You can add a documentation comment to a constant but not to the value of a macro. Eventually, the language service will pick up this comment and provide a useful information to the user.
- A constant is known by IntelliSense.
- A constant is cross-referenced. Therefore, you can find all references for a specific constant but not for a macro.
- A constant is subject to access modifiers. You can use the private, protected, and public modifiers. The accessibility of macros isn't rigorously defined.
- Constant variables have scope, whereas macros don't have scope.
- You can see the value of a constant or a read-only variable in the debugger.
- Full control of the type for the constant.
- You can also define constants as variables only. The compiler will maintain the invariant so that the value can't be modified.
- A significant effect on the performance of the compiler.
No comments:
Post a Comment