fork 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 orig = new List<List<double[]>> {
  10. new List<double[]> {new[] {1.0, 2.0}, new[] {3.0, 4.0}, new[] {5.0, 6.0}}
  11. , new List<double[]> {new[] {7.0, 1.0}, new[] {8.0, 2.0}}
  12. , new List<double[]> {new[] {9.0, 4.0}, new[] {3.0, 1.0}}
  13. };
  14. var res = orig.
  15. Select(list => list
  16. .Select(array => array.Concat(new[] {0.0}).ToArray())
  17. .ToList()
  18. ).ToList();
  19. foreach (var o in res) {
  20. foreach (var a in o) {
  21. Console.WriteLine(string.Join(", ", a));
  22. }
  23. Console.WriteLine("---");
  24. }
  25. }
  26. }
Success #stdin #stdout 0.05s 24344KB
stdin
Standard input is empty
stdout
1, 2, 0
3, 4, 0
5, 6, 0
---
7, 1, 0
8, 2, 0
---
9, 4, 0
3, 1, 0
---