I know there are a couple of similarly formulated questions about SO about permutations of listings, but they don't seem to address exactly what I'm looking for. I know there is a way to do this, but I draw a space. I have a flat file similar to this format:
Col1|Col2|Col3|Col4|Col5|Col6 a|b,c,d|e|f|g,h|i . . .
Now here's the trick: I want to create a list of all possible permutations of these lines, where the list, separated by commas in the line, represents possible values. For example, I would have to take the IEnumerable<string> representing above into the strings as such:
IEnumerable<string> row = new string[] { "a", "b,c,d", "e", "f", "g,h", "i" }; IEnumerable<string> permutations = GetPermutations(row, delimiter: "/");
This should generate the following collection of string data:
a/b/e/f/g/i a/b/e/f/h/i a/c/e/f/g/i a/c/e/f/h/i a/d/e/f/g/i a/d/e/f/h/i
It seems to me that it will fit elegantly into the recursive method, but apparently I have a bad case of Monday, and I canβt completely plug my brain around how to approach it. Some help would be greatly appreciated. What should GetPermutations(IEnumerable<string>, string) look like?
Jeremy holovacs
source share