method call question

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
C

Claudia Fong

I have a method GetResult that receives 2 string arguments and I want
this method to return an array of string. Is it possible?

string[ ] GetResult (string s1, string s2);

I tried to define like this, but when I called the method it shows me an
error cannot convert string [ ] into string

Can someone tell me how to do it?

Cheers!

Claudi
 
Claudia said:
I have a method GetResult that receives 2 string arguments and I want
this method to return an array of string. Is it possible?

string[ ] GetResult (string s1, string s2);

I tried to define like this, but when I called the method it shows me an
error cannot convert string [ ] into string

Can someone tell me how to do it?

You don't give enough info here to determine the problem. Can you
provide a short but complete example that shows the issue? For example,
the following works fine:

class Class1
{
string [] GetResult(string s1, string s2)
{
string [] result = new string[2]{s1,s2};
return result;
}

void DoIT()
{
string [] tmp = GetResult("a","b");
}
}
 

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

Back
Top