LINQ查询...如何执行?

Mon*_*mie 0 c# linq linq-to-entities

说我有下一个序列:

1
2
3
4
5
6
7
8
9
10
Run Code Online (Sandbox Code Playgroud)

我需要与Linq做下一件事:

1,2;
2,3;
3,4;
4,5;
...
9,10;
Run Code Online (Sandbox Code Playgroud)

无法得到它.

cuo*_*gle 5

这是你想要的吗?

 var list = new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

 var result = Enumerable.Range(0, list.Length - 1)
                        .Select(i => new[] {list[i], list[i + 1]});
Run Code Online (Sandbox Code Playgroud)