Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.75 KB

NestedFunctionInParameters.md

File metadata and controls

31 lines (20 loc) · 1.75 KB

Initialization of method and constructor parameters by calling nested methods (NestedFunctionInParameters)

Description

Similarly, it is not recommended to use nested calls of other functions or other parameterized constructors when initializing constructor parameters
.

At the same time, if the code with nested calls is compact (does not require the hyphenation of expressions) and is easy to read, then nested calls are acceptable.

Examples

Incorrect:

Attachments.Insert(  AttachedFile.Description,  New Picture(GetFromTempStorage(   AttachedFiles.GetFileData(AttachedFile.Ref).RefToFileBinaryData)));

It is correct to break such calls into separate operators using additional local variables:

FileImageHRef = AttachedFiles.GetFileData(AttachedFile.Ref).RefToFileBinaryData; PictureData = New Picture(GetFromTempStorage(FileImageHRef)); Attachments.Insert(AttachedFile.Description, PictureData);

Sources