Hi Friends,
Can method parameter be 'reference' object, which can return value after set inside method?
Thanks,
*This post is locked for comments
Hi Ganriver,
You can use the X++ keyword byref to call .NET methods that take parameters by reference.
In all X++ methods, all parameters are passed by value. In .NET, parameters can be passed by value or by reference.
You must understand the parameter passing concepts of by value versus by reference before you can correctly use the byref keyword.
You can use this link :
I really can't agree that value types in C#, such as int, are reference types. Boxing wan't help you with to pass value types by reference; you need ref/out keywords to do that (as mentioned by Joris).
X++ allow you to do that with CLR methods (byref keyword), but not with X++ methods.
Thanks
Hi Martin,
What I mean is, in C#, everything is pretty much object, you can pass in method, set value, and get it outside of method.
How about X++, like if I pass in a string or recid, can I do the same?
X++ doesn't have reference parameters as such. However, Tables and Classes are implicit pointers so they are passed by reference automatically. Primitive types like int, str, etc. cannot be passed by reference, there is no support for that in X++.
Yes, you can use objects as parameters and change their internal state inside methods.
If you meant something else, please rephrase your question.
all classes extending from AXInetrnalBase are having such methods, which set and return value.
e.g. AXSalesTable (Class), AXCustTable (Class)
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,802 Super User 2024 Season 2
Martin Dráb 229,133 Most Valuable Professional
nmaenpaa 101,154