Announcements
Hi Friends,
Can method parameter be 'reference' object, which can return value after set inside method?
Thanks,
*This post is locked for comments
all classes extending from AXInetrnalBase are having such methods, which set and return value.
e.g. AXSalesTable (Class), AXCustTable (Class)
robertxliang.blogspot.com/.../axinternalbase-class.html
dynamicsaxbr.tumblr.com/.../ax-class-parte-2
Yes, you can use objects as parameters and change their internal state inside methods.
If you meant something else, please rephrase your question.
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++.
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?
Thanks
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.
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 :
msdn.microsoft.com/cc586700.aspx
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.