web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DaxGeek / Methods with Parameters

Methods with Parameters

Hossein.K Profile Picture Hossein.K 6,650
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:  private void methodWithParameters(str _parm1, int _parm2  
2: = 1)
3: {
4: }
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

Comments

*This post is locked for comments