Region directive in AL
APPLIES TO: Business Central 2020 release wave 2 and later
Region
The #region
directive 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're currently working on. The #endregion
specifies the end of a #region
block of code.
Note
On the first line of the #region
a text comment can be added to describe the purpose of the block of code, see the following example.
Syntax
#region [comment]
code
#endregion
Remarks
A #region
block must be terminated with a #endregion
directive.
A #region
block can't overlap with an #if
block. However, a #region
block can be nested in an #if
block, and an #if
block can be nested in a #region
block.
Example
In this example, the #region
directive makes a code block that is up for refactoring collapsible.
#region Ugly code - let's not look at this
procedure UglyCode()
begin
// No one should look at this
end;
#endregion
See also
Development in AL
AL development environment
Pragma directive in AL
Conditional directives
Deprecating explicit and implicit with statements
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho