how to return two string values in a C# Class library
how to return two string values in a C# Class libraryhow to return two string values in a C# Class library
Page 1 of 1
6 Replies - 4060 Views - Last Post: 18 March 2009 - 09:16 AM
#1
how to return two string values in a C# Class library
Posted 18 March 2009 - 07:36 AM
Replies To: how to return two string values in a C# Class library
#2
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 07:38 AM
how to return two string values in a C# Class library
#3
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 07:43 AM
Post what you have tried and you'll get a better response.
#4
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 08:00 AM
with a routine's parameters. you can even put 'ref' in front of the parameter to make sure everyone notices it's by reference.. though I don't think that is necessary since c# should pass everything by ref.
#5
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 08:15 AM
I think that what you are looking for is to hve a method for your class that returns two strings? If this is so, it is not possible (as far as I know) in the way you are asking for. You could do either of the following
1 - Return an array of some description containing both strings, or...
2 - Return an custom class containing both your string fields. This I would recommend - if your common object you want to return has 2 fields (strings in this case) shouldn't you have a class for it?
1 - Return an array of some description containing both strings, or...
2 - Return an custom class containing both your string fields. This I would recommend - if your common object you want to return has 2 fields (strings in this case) shouldn't you have a class for it?
This post has been edited by ragingben: 18 March 2009 - 08:16 AM
#6
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 08:57 AM
Topics merged, please don't create duplicate topics
#7
Re: how to return two string values in a C# Class library
Posted 18 March 2009 - 09:16 AM
List<string> Return2Strings()
{
string one = "string one";
string two = "string two";
List<string> stringList = new List<string>();
stringList.Add(one);
stringList.Add(two);
return stringList;
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote









|