Personally, I don't enjoy this all that much:
Enumerable.Range(0, GetTotalEmployees()), at least when compared to doing something more like this:
.Where(a => a % 2 == 0)
// 0, 2, 4, ... , 6, 8... 2n
Simply by adding this extension somewhere:
public static IEnumerable<int> To(this int from, int to)
for (int i = from; i < to; i++)
yield return i;
Admittedly it could be made more robust
- Check that
from is less than
- Add Optional parameter for step.
- Type parameterizing based on the Type of step or of the
to parameter so that it can produce ints or doubles.
But for the most part this works well.