The naming convention in X++ (and C# by the way) is to postfix
attribute classes' name with
"Attribute". When using the attribute to decorate a class, it is a bit verbose to type in "Attribute" as it is apparent from the context, so now in X++ - just like in C# - you can skip the last part of the name.
Example:
Now, there is a difference in opinion on which one is best. One camp
would argue that the shorter code is easier to read and write. Another
camp would argue that referring to the same type in two different ways
makes tooling (like refactoring tools, F12/Go to declaration and cross
references tool) harder to implement. I agree with both, however, now
the door is opened for this dual way of referencing and the tooling
needs to follow suit. I'm in favor for the short notion.
"Attribute". When using the attribute to decorate a class, it is a bit verbose to type in "Attribute" as it is apparent from the context, so now in X++ - just like in C# - you can skip the last part of the name.
Example:
class MyTestCase extends SysTestCase
{
[SysTestMethodAttribute]
public void testCase1()
{
}
}
{
[SysTestMethodAttribute]
public void testCase1()
{
}
}
Is semantically identical to:
class MyTestCase extends SysTestCase
{
[SysTestMethod]
public void testCase1()
{
}
}
{
[SysTestMethod]
public void testCase1()
{
}
}
No comments:
Post a Comment