Tuesday, July 3, 2018

Methods with Parameters

All methods in X++ have their own scope. To use data from a different scope,
transfer the data into the new scope using parameters.
A method can have one or more parameters. Within the scope of the method
these parameters are treated like local variables, initialized with the value from
the parameter in the method-call.


1
2
3
private void methodWithParameters(str parm1,int _parm2 = 1)  
{  
} 
All parameters are passed by value, this means you cannot change the value of
the original variable, but only the local variable in the method, which is a copy of
the original.
In the previous example, the second parameter is assigned a default value. This
means that when the method is called, the second parameter is optional. If it is
called without a second parameter, _parm2 will be set to 1.


Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...