fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var res = new[] {"quick:brown", "fox:jumps", "over:the", "lazy:dog"}
  9. .Select((v, i) => new {Index = i, Value = v})
  10. .GroupBy(p => p.Index / 2)
  11. .ToDictionary(g => g.First().Value, g => g.Last().Value);
  12. foreach (var p in res) {
  13. Console.WriteLine("{0} - {1}", p.Key, p.Value);
  14. }
  15. }
  16. }
Success #stdin #stdout 0.01s 131648KB
stdin
Standard input is empty
stdout
quick:brown - fox:jumps
over:the - lazy:dog