String generator issue

Posted by Andrey on Stack Overflow See other posts from Stack Overflow or by Andrey
Published on 2013-06-26T15:46:19Z Indexed on 2013/06/26 16:21 UTC
Read the original article Hit count: 131

Filed under:
|
|
|

I want to write a method which returns a string. So far so good. The creation of the string however is quite complicated. I have 3 string lists - the first one has 155 entries, the second one - 9, the third one 21. I want my method if called enough times(155*9*21) to return all the possible combinations of values from the 3 lists (basically this method should keep count on how many times it was called and return only one combination each time). Any ideas how to accomplish that?

I have 155*9*22 possible combinations. The first time the method is called it should take List1(0), List2(0), List3(0). After that in the next 21 iterations, the index of the third list is only changed. Once all the elements from the third list have been used increment the index of the second list and so on.

Once the method has produced all the possible combinations (155*9*22) I want it to start from the beginning.

© Stack Overflow or respective owner

Related posts about c#

Related posts about string