Last active
February 27, 2017 01:39
-
-
Save Fhernd/176753e91762a831f5ff3a6d6208260b to your computer and use it in GitHub Desktop.
Genéración de los n-ésimos elementos de una colección.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int n = 20; | |
List<int> serie = Enumerable.Range(1, 100).ToList(); | |
List<int> nesimosElementos = new List<int>(); | |
Enumerable.Range(0, serie.Count() / n) | |
.ToList() | |
.ForEach( | |
indice => | |
{ | |
nesimosElementos.Add(serie.Skip(indice * n).First()); | |
} | |
); | |
nesimosElementos.Dump("20-ésimos Elementos de la Serie 1-100"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment