Desktop version

Main > Forum > Learning > 1C Mobile Developer Course > What is #Region and anyone can help me explain in what case we should use this - Module 5: Infobase

Forum

Search UsersRules
What is #Region and anyone can help me explain in what case we should use this - Module 5: Infobase
#1
Active user
Points:: 0
Joined:: Jan 11, 2021

Hi everyone,
I am reading the code in the sample Inforbase of Module 5 and I see #region.


And I did try to find its information in CTRL+F1 but it is quite short.


Anyone can help me explain what is #Region in the code and What we should use this for?

Thank you.

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hello,

in the 1C language, it's possible to combine code in areas (regions). They are convenient in that they can be collapsed and expanded, just like procedures and functions. This improves the readability of our code, for example, we can collapse a query that is too long, or we can merge several procedures into a scope.

Code
#Region LibrariesHandlers

// StandardSubsystems.AttachableCommands
&AtClient
Procedure Attachable_ExecuteCommand(Command)
   AttachableCommandsClient.ExecuteCommand(ThisObject, Command, Object);
EndProcedure

&AtServer
Procedure Attachable_ExecuteCommandAtServer(Context, Result)
   AttachableCommands.ExecuteCommand(ThisObject, Context, Object, Result);
EndProcedure

&AtClient
Procedure Attachable_UpdateCommands()
   AttachableCommandsClientServer.UpdateCommands(ThisObject, Object);
EndProcedure
// End StandardSubsystems.AttachableCommands

#EndRegion


You can read more details in the help (syntax - assistant)

Profile
#3
Active user
Points:: 0
Joined:: Jan 11, 2021

So #Region is used to combine Function and procedure and the code still run with out function, right?

Profile
#4
Administrator
Points:: 0
Joined:: Oct 3, 2019

Yes, this does not affect the execution of the code. This instruction is only needed for the convenience of the developer.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.