Return two values from a method

  • Thread starter Thread starter CSharper
  • Start date Start date
C

CSharper

Is it possible to return two string values from a method which has
yeild in it?
 
CSharper said:
Is it possible to return two string values from a method which has
yeild in it?

It's not clear what you mean. Do you mean you want to yield elements
which each have a pair of strings? If so, encapsulate that pair of
strings in another type, then make the return type
IEnumerable<PairOfStrings> (or whatever).
 
It's not clear what you mean. Do you mean you want to yield elements
which each have a pair of strings? If so, encapsulate that pair of
strings in another type, then make the return type
IEnumerable<PairOfStrings> (or whatever).

Thanks Jon, My current implementation is exactly the same. But what I
am trying to see if I can reduce the consuming objects dependency to
another new class (in this case the pairofstrings). I think you are
right, if it is the only wau, I will stay on the same approach.
Thanks again for the time.
 

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