Region Directive in AL (Business Central 2020 Wave 2)

Hello Readers, 

  

Hope you all are doing good with the new Business Central 2020 Wave 2 Release (BC17).

I was going through the new features released in the Business Central 2020 Wave 2 (BC17), i found the feature which is very useful for the developers i.e. Region Directive.

The #region is used to mark a block of code that you can expand or collapse. This can, for example, be useful for larger files for better readability or for focusing on code that you are currently working on. The #endregion specifies the end of a #region block of code.

A #region block must be terminated with a #endregion directive.

lets have a look how it works:

So in the below example i created a codeunit and set of functions and added 2 regions (as shown below).

1. #region Hello World

2. #region Ping Pong

Now when you collapse the region all the codes function written under the region will get collapsed (as shown below)

 

System collapsed all the functions written inside the #region Hello World.

 

 

Thank you,

Anish Agrawal

NAV/Business Central Developer

Connect me on : +91-9770757595

Linkedin :Anish Agrawal

Leave a Reply

Your email address will not be published. Required fields are marked *