fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var data = new Dictionary<string,string>{
  10. {"question1", "7"},
  11. {"question1_comment", "pretty difficult"},
  12. {"question2", "9"},
  13. {"question2_comment", ""},
  14. {"question3", "5"},
  15. {"question3_comment", "Never on time"},
  16. };
  17. var res = data
  18. .Keys
  19. .Where(s => !s.EndsWith("_comment"))
  20. .Select(s => new[] {s, data[s], data[s+"_comment"]})
  21. .ToList();
  22. foreach(var a in res) {
  23. Console.WriteLine(string.Join(", ", a.Select(s => string.Format("'{0}'", s)).ToArray()));
  24. }
  25. }
  26. }
Success #stdin #stdout 0.09s 24288KB
stdin
Standard input is empty
stdout
'question1', '7', 'pretty difficult'
'question2', '9', ''
'question3', '5', 'Never on time'