[英]LINQ: How to skip one then take the rest of a sequence
i would like to iterate over the items of a List<T>
, except the first, preserving the order. 我想迭代
List<T>
,除了第一项,保留订单。 Is there an elegant way to do it with LINQ using a statement like: 有没有一种优雅的方法可以使用如下语句对LINQ执行此操作:
foreach (var item in list.Skip(1). TakeTheRest() ) {....
foreach(列表中的var项目.kip(1) .TakeTheRest() ){....
I played around with TakeWhile
, but was not successful. 我和
TakeWhile
一起TakeWhile
,但没有成功。 Probably there is also another, simple way of doing it? 可能还有另一种简单的方法吗?
不是吗......
foreach (var in list.Skip(1).AsEnumerable())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.