How to do explicit casting from CLRObject to CLRObject?


My scenario is that I am reading RESX file in X++. The issue is the file might contain embedded image files as well along with embedded strings. Now the .NET code snippet to read such file is shown below.


You can see that in .NET we are explicitly casting DictionaryEntry object to ResXDataNode object to read embedded image files. The issue is I am unable to do explicit casting between these two CLRObjects. Please help! You can see the X++ code below. Currently it is giving a compile time error. Quick reply would be highly appreciated. Thanks in advance.

I believe that X++ compiler isn’t able to verify this case statically. Is there any problem with the dynamics cast? (resXDataNode = dictEntry.get_Value())

Yes you are correct :slight_smile: AX dynamic casting is working.