AX 2012 Method -Accessor method
For developers who are new to AX, and especially those coming from other products, the Accessor method, a type of AX 2012 Method,
may be a little confusing at first. You may be used to seeing the Get/Set keywords used like this…
{
private string _mystring;
public string mystring
{
get { return _mystring; }
set {_mystring = somevalue;}
}
}
AX 2012 Method
In an AX 2012 Method, the same logic would be expressed in this way…
{
str myString;
publicstr myString(str _myString = myString)
{
myString = _myString;
return myString;
}
}
Get and Set happen here in the same method.
If the method is called with parameter_myString having a value, then the class variable (myString) is set to this value…
myString = _myString;
If the method is called without a parameter, the parameter defaults to the class variable…
(str _myString = myString)
No comments:
Post a Comment