Can anyone explain the strange behavior I'm seeing with the ternary operator in AX 2012? I have a line of code like this:
int numLines;
numLines = (myCLRArray != null) ? myCLRArray.get_Length() : 0;
This used to work in AX 2009 but in AX 2012 I get the following warning from the compiler:
Operand types are not compatible with the operator.
If I change the code to use a normal If/Else, the compiler does not complain:
int numLines;
if(myCLRArray != null)
numLines = myCLRArray.get_Length();
else
numLines = 0;
I have a lot of these ternary operators in the code that I'm porting from AX 2009 so I'm curious if anyone knows what's wrong with using the ternary operator like am trying to.
*This post is locked for comments
I have the same question (0)