fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var dict = new Dictionary<String, List<String>>() {
  10. {"1",new List<String>(){"a", "b"}},
  11. {"2",new List<String>(){"c", "d", "e"}},
  12. {"3",new List<String>(){"f", "g", "h"}},
  13. };
  14. var result = from kv in dict
  15. from val1 in kv.Value
  16. from val2 in kv.Value
  17. select string.Format("{0}{1}", val1, val2);
  18.  
  19. int combiCount = 0;
  20. foreach (var combi in result)
  21. Console.WriteLine(++combiCount +". " + combi);
  22.  
  23. }
  24. }
Success #stdin #stdout 0.04s 37184KB
stdin
Standard input is empty
stdout
1. aa
2. ab
3. ba
4. bb
5. cc
6. cd
7. ce
8. dc
9. dd
10. de
11. ec
12. ed
13. ee
14. ff
15. fg
16. fh
17. gf
18. gg
19. gh
20. hf
21. hg
22. hh