c# - Extension methods equivalents for CAR and CDR in .Net's Linq/IEnumerable -
c# - Extension methods equivalents for CAR and CDR in .Net's Linq/IEnumerable -
i know can someenumerable.first()
. there's no .rest
.
i know write one, wondering if missing something.
related question: are there ruby equivalents car, cdr, , cons?
for cdr
can utilize enumerable.skip(1)
like:
var cdrresultquery = someienumerable.skip(1);
consider next example:
ienumerable<int> someienumerable = new list<int> {1, 2, 3, 4, 5}; var cdrresultquery = someienumerable.skip(1); foreach (var in cdrresultquery) { console.writeline(i); }
and get:
2 3 4 5
c# linq ienumerable
Comments
Post a Comment