how to get a String[] as a return value when using c# lib in a c++ project?

V

Vivienne

Hi,

I am using a c# lib in my c++ project, with VS2005 as the IDE.
class InCollection is a class defined in c# lib, its method
getMemebers() will return all of its members as a System::string[] .
Like this:

InCollection mycollection = new InCollection();
System.String[] members = mycollection.getMembers();

I want to call this method in my c++ project, so I wrote:

InCollection^ mycollection = gcnew InCollection();
System::String^[] members = mycollection->getMembers();
// here I got a compiling error. System::String^[] seems not a valid
expression.

Similar thing happened when a method take a String[] as an argument.
like:
mycollection.addMemebers(new String[] {"abc", "123"});

So how should I use the two methods?
 
G

Guest

Using ** (pointer to pointer), string is array of chars, string array it's a
array of array of char, that why it pointer to pointer.

Check what the equivalent phrase on managed c++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top