X++ Standards: Comments [AX 2012]
Updated: November 30, 2011
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Use // for both single and multiline (block) comments. There should be a space between the "//" and the start of the comment.
Comments should be in US-English and start with an uppercase letter (unless the first word is a lowercase name).
Put comments on a separate line before the code they are describing. The only exception to this is when you are describing parameters. In this case, put one parameter per line, with the comment describing it to the right of the parameter.
When creating a multiline comment, do not write on the first or the last line of the comment (as shown in the following example).
// Single line comment
// Comment on multiple lines.
// Do not add text to 1st or last line of comment.
Comments should not include:
Version or layer references
Bug numbers – unless it is a workaround, or unless the code could appear inappropriate if you didn't know that it was for a bug fix.
Politically or culturally sensitive phrases
If you put a comment at the start of the method to describe its purpose and use, you can use block comments (/* */).