c# - Aggregate sub-lists using LINQ -
I have a list of objects (i.e. integer) and I want to add sub-lists with LINQ.
For example:
Basic list: Sub-lists: Results (aggregate list): I want to create a maximum sub-list for the maximum and the following Thank you in advance, Christian or in a line [1, 4, 5, 3, 4, 10, 4, 12]
[[1,4,5,3], [4,5,3,4], [5,3,4 , 10], [3, 4, 10,4], [4,10,4,12]
[5, 5, 10, 10, 12]
n = 3 elements for each element . Is it possible with LINQ or do I need to create my own aggregation system?
public INIM rank & lt; IEnumerable & lt; Int & gt; & Gt; GetSubLists (int [] collection) {for (int i = 0; i & lt; collection.Length - 3; i ++) yield returns collection. Skip (i). Take (4); GetSubLists (original). Select (l => L. Max ());
int [] original = {1, 4, 5, 3, 4, 10, 4, 12}; Int Chuckcon = 4; Enermereble.Range (0, root - chuncount + 1). Select (i = & gt; Original. Skip (i) Take (Chuckcount). Select (L => L. Max ());
Comments
Post a Comment