how do access previous item in list using linQ?

后端 未结 5 684
南笙
南笙 2020-12-14 03:24

I have:

List A  = new List(){1,2,3,4,5,6};

List m=new List();
for(int i=1;i

        
5条回答
  •  Happy的楠姐
    2020-12-14 03:34

    How about something like

    var l = A.Skip(1).Select((x, index) => x + A[index]).ToList();
    

提交回复
热议问题