How to: Substitute Primitive Parameter Types Between the CLR and X++ [AX 2012]
Updated: February 14, 2012
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
In Microsoft Dynamics AX, an X++ str type can be passed in a call to a .NET Framework method or X++ method that requires a System.String parameter as its input. However, substitutions in the other direction are not supported. An X++ method that requires an str parameter does not accept a System.String.
The same rule applies to the other X++ primitive types and their .NET Framework counterparts. Therefore an X++ int parameter can be passed to a method that takes a System.Int32. But a System.Int32 cannot be passed into a method that takes an X++ int.
It makes no difference whether the method that takes the parameter is a .NET Framework method or an X++ method.
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.