Page 1 of 1

get contents of array returned by method in .Net Assembly

Posted: Sat Aug 08, 2009 11:41 am
by ConvertFromOldNGs
by John Munro >> Fri, 7 Aug 2009 20:52:37 GMT

I have imported a .NET dll. I will be creating an instance of an object
imported from the dll, and I need to be able to call a method on the
object that returns an array of other objects.

My problem is that the method imported into Jade has a return type of
JadeDotNetType, and I don't know how to turn that into an array.

Anyone have any ideas?

John

Re: get contents of array returned by method in .Net Assembl

Posted: Fri Sep 24, 2010 4:36 am
by rangerdunadan
Hey John,

Did you figure out how to do this? I have the same issue.... .NET is returning a System.String[] and Jade has returned a JadeDotNetType. I don't know how to use the JadeDotNetType to get the individual strings from the System.String[].

I'm wondering if I need to import the mscorlib into Jade??

What do you think?

Ranger.

Re: get contents of array returned by method in .Net Assembl

Posted: Fri Sep 24, 2010 5:21 am
by ghosttie
String arrays aren't supported (NFS #52700). If you're writing the .NET dll, you could create a method to get the individual strings in the array e.g. get(index : Integer) : String;

Re: get contents of array returned by method in .Net Assembl

Posted: Fri Sep 24, 2010 8:17 am
by rangerdunadan
Thank you for the reply.

Do you know if a byte[] is supported or is the recommended way to return individual bytes?

Thanks again for you quick reply.

Ranger.

Re: get contents of array returned by method in .Net Assembl

Posted: Fri Sep 24, 2010 8:43 am
by ghosttie
I don't know for sure, but I don't think any primitive arrays are suported

Re: get contents of array returned by method in .Net Assembl

Posted: Fri Sep 24, 2010 2:04 pm
by Jade Support
@rangerdunadan, ghosttie is correct, no primitive array types are supported. The aforementioned NFS (#52700) is open to address this.

An alternate solution could be to create a small .NET component with a method that takes a string and returns a string array. In JADE this would be imported as a method that takes a StringUtf8 and returns a JadeDotNetType. This returned value could then be used wherever a .NET string array is required.

If you don't want to create your own component, then you may want to consider importing part of mscorlib which contains the definition of the .NET String type. String has a method, 'Split' which divides a string up into an array of substrings.

I hope this helps.

Regards,