c# - How to select values within a provided index range from a List using LINQ -
I am trying to use it to get the following:
I have a List is Ints: -
list & lt; Int & gt; IntList = new list & lt; Int & gt; (New int [] {1,2,3,3,2,1});
Now, I want to compare the amount of first three elements [index range 0-2] using the LINQ from the last three [index 3-5]. I tried and select LINQ and bring the SelectMany method along with extension methods, but I can not understand that
to say something like (from p in intList where Select Elements from p to intList from p Select the index x to x + n p) .sum ()
I see that the extension is also an extension, but I do not have to see it That's what I want. Any suggestions? Thank you. Use
then use.
yourEnumerable.Skip (4). (3). (X = & gt; x) (intList.Skip (x)) Select P from (P) Select P) .sum ()
Comments
Post a Comment