-7

i create a dll with C# framework 2.0 and want use that in another applications... but i have a problem i cannot return two value from method for example:

        public string Two_String_Returner()
    {
        int aa = 50;
        string bb = "Hello";
        return aa.ToString();
        return bb;
    }

1-i must return two value, once is int and another is string 2- this return should be Apart from each other

i how can do this?

  • 2
    You could return a structure or a class. You can return a Tuple or use ref or out params. Or you could use google.. – TaW Mar 07 '19 at 21:21
  • if is possible give me a example return two value code please – reza khademi Mar 07 '19 at 21:41
  • The thing is: YOU CAN'T. But you can either return a complex 'package' with 2 (or more) values inside or use `ref` or `out` parameters. Do get yourself a tutorial, a book or use google. SO is not the right place for this kind of question! – TaW Mar 07 '19 at 21:45
  • Yes,i before ask question tryed to solve that but i did not success and ask for help، for example I tested the Tuple but that return multiple value in one return,i want return the value in apart of each and pop returns whit nsis – reza khademi Mar 07 '19 at 21:58
  • I do not know what _pop returns whit nsis_ might mean but the truth is: You can't always get what you want, even if you think you know what it is. – TaW Mar 07 '19 at 22:20

1 Answers1

-2

You can return an array of strings.

public string[] Two_String_Returner()
{
    int aa = 50;
    string bb = "Hello";
    return new string[] { aa.ToString() ,  bb};
}
Spell
  • 384
  • 4
  • 11