I have the following method:
public string Phase(string phase)
{
return "Phase 1";
}
The thing is I need it to output 2 strings in 2 different labels:
“Phase 1”
“Phase 2”
Is there a way for me to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have a few options to return multiple values.
For example, you could return an
IEnumerable<string>(or some other collection). You could also return aTuple<string,string>.Or
That being said, it might be simpler to use two separate methods (or properties) to return each string, instead of trying to force it into a single method call.
Another alternative would be to pass in an argument which allowed the method to choose which label to return:
Edit:
Given your comments, I would recommend a property that just returned an array:
You could then use this as: