Code region compiler directive
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Enabled for | Public preview | General availability |
---|---|---|
Admins, makers, marketers, or analysts, automatically | Aug 1, 2020 | Oct 1, 2020 |
Business value
Use code regions to structure related code, add documentation of code sections, and expand or collapse these for fast navigation in your code with easy outlining of the code.
Feature details
Directives is a new construct in the AL language that specifies how the AL compiler treats an enclosed section of code. The same concept is known in other languages. The specific directive instructions must be supported by the compiler—you cannot create custom preprocessing instructions.
We now introduce two new directives for enclosing a section of code and define it as a region.
Note
A #region block must be terminated with an #endregion directive as shown in the following examples.
Example
Example of defining regions in a code unit.
Example of collapsing regions.
Thank you for your idea
Thank you for submitting this idea. We listened to your idea, along with comments and votes, to help us decide what to add to our product roadmap.