Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Last active February 27, 2017 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/176753e91762a831f5ff3a6d6208260b to your computer and use it in GitHub Desktop.
Save Fhernd/176753e91762a831f5ff3a6d6208260b to your computer and use it in GitHub Desktop.
Genéración de los n-ésimos elementos de una colección.
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