Monday, May 22, 2017

X++ new features in D365 F&O

DECLARE ANYWHERE:-  Previously, all local variables had to be placed at the start of the method in which they’re used. Readability is enhanced. You can reduce the risk of reusing a variable inappropriately during long-term maintenance of the code.

Static Constructor and Static field:- Static constructors are guaranteed to run before any static or instance calls are made to the class.

Const/ReadOnly:-  the const is known by IntelliSense, The const is subject to access modifiers, either private, protected, or public. The accessibility of macros is not well understood or even rigorously defined. Consts have scope, while macros do not

Var:-  It’s only possible to use var on declarations where an initialization expressions are provided

Private and Protected member varaibles:- Previously, all member variables defined in a class were invariably protected. It’s now possible to make the visibility of member variables explicit by adding the private, protected, and public keywords.

Extension method:- The extension class must be static, The name of the extension class must end with the ten-character suffix _Extension. However, there’s no restriction on the part of the name that precedes the suffix, Every extension method in the extension class must be declared as public static, the first parameter in every extension method is the type that the extension method extends. However, when the extension method is called, the caller must not pass in anything for the first parameter. Instead, the system automatically passes in the required object for the first parameter. 

Finally in try/catch statements :- Try/catch statements can now include an optional finally clause. The statements in the finally clause are executed when control leaves the try block, either normally or through an exception.

No comments:

Post a Comment