fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7.  
  8. public static void Main()
  9. {
  10. Dictionary<string, List<String>> dict = new Dictionary<string, List<String>>();
  11. dict.Add("STAR-016", new List<string>() {
  12. "value a", "value b", "value c", "value 1, value 2, value 3", "value d"
  13. });
  14.  
  15. foreach (var kvp in dict)
  16. {
  17. for (int i = kvp.Value.Count -1; i >= 0; i--)
  18. {
  19. string str = kvp.Value[i];
  20. if (str.Contains(','))
  21. {
  22. string[] parts = str.Split(',').Select(p => p.Trim()).ToArray();
  23. kvp.Value.RemoveAt(i);
  24. kvp.Value.InsertRange(i, parts);
  25. }
  26. }
  27. }
  28.  
  29. foreach(var kvp in dict)
  30. foreach(string s in kvp.Value)
  31. Console.WriteLine(s);
  32. }
  33.  
  34. }
  35.  
Success #stdin #stdout 0.05s 34080KB
stdin
Standard input is empty
stdout
value a
value b
value c
value 1
value 2
value 3
value d