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 list = new[]{"One","Two","Three","Four","Five"};
  10. var result = list.Select((s,i) => new {This=s,Next=list.ElementAtOrDefault(i+1)});
  11. foreach(var x in result)
  12. Console.WriteLine("{0}.{1}",x.This,x.Next);
  13. }
  14. }
  15.  
Success #stdin #stdout 0.03s 37024KB
stdin
Standard input is empty
stdout
One.Two
Two.Three
Three.Four
Four.Five
Five.