Notifications
Announcements
No record found.
Is there an X++ equivalent to C#'s out parameter? msdn.microsoft.com/.../t3c3bfhx.aspx
If not, what is best practices for returning multiple parameters from a method call? Container?
*This post is locked for comments
in case of returning multiple parameter. try this
container whatever()
{
return ['a',34'];
}
No X++ is not having out parameter equivalent to C#
Yes if you what a method to return multiple variable you need to return Container from the method.
I don't think there is none, in the same way as C#. The same applies to pointing a method as a parameter. Some of the constructs from C# not yet in X++.
May I ask why you want the out modifier?
About out:
msdn.microsoft.com/.../t3c3bfhx.aspx
About passing values by reference in X++ compared to C#:
msdn.microsoft.com/.../cc586700.aspx
X++ supports byref keyword which can be used for out parameters (out and ref in C# are almost identical), but only in the context of .NET Interop. See How to: Use the byref Keyword for CLR Interop for details.
Object oriented programming use objects for grouping related data. It's much safer using a specialized object than weakly-typed containers, because the code is more readable and types are checked by compiler. It's also generally more efficient to pass a mere reference than all data. There may be a situation when you want to use a container, mainly when you want to transfer the data across tiers (e.g. from server to client), but then it's better if you implement pack() and unpack() for your class, hide serialization details there and use passing by reference or by serialized value as needed.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2