Static methods, or
class methods, belong to a class and are created by using the keyword static. They are called by using the following
syntax:
ClassName::methodName();
You do not need to
instantiate an object before you use static methods. Static methods are widely
used in Microsoft Dynamics AX to work with data that is stored in tables.
Note
|
It is not possible to use member variables
in a static method.
|
A main method is a class method that is executed
directly from a menu option.
static void
main (Args _args)
{
// Your X++ code here.
}
{
// Your X++ code here.
}
The method should only
create an instance of the object and then call the necessary member methods.
The _args parameter allows you to transfer data to the
method.
No comments:
Post a Comment