0

I have a list who has got 7 members.

List<string> li = new List<string>();
li.Add("a");
li.Add("b");
li.Add("c");
li.Add("d");
li.Add("e");
li.Add("f");
li.Add("g");
for (int i=0; i<7;i++)
{
   for (int j=1;j<7;j++)
   {
       for (int k=2; k<7; k++)
       {
          //. . . 
          //. . . 
          //. . .
       }
   } 
}

And i want to do that via for iteration: ab,ac,ad,ae,af,ag,bc,bd,be,bf,bg,cd,ce,cf,cg,de,df,dg,ef,eg,abc,abd,abe,.....,abcd,abce,...,defg.....,abefg,....abcdefg.

I mean i want to find every 2-3-4-5-6 combination each others. How can i do that?

lotomax
  • 113
  • 2
  • 12
  • 4
    There's a nice [blog series by Eric Lippert](https://ericlippert.com/2013/04/15/producing-permutations-part-one/) about permutations in c#. – René Vogt Mar 07 '17 at 18:08
  • Possible duplicate of [Getting all possible combinations from a list of numbers](http://stackoverflow.com/questions/3319586/getting-all-possible-combinations-from-a-list-of-numbers) – Muhammad Saqlain Mar 07 '17 at 18:13
  • Thank you but It isn't same what i want to do. – lotomax Mar 08 '17 at 07:10

0 Answers0