I sometimes want to generate a list of numbers going "up" and "down" from a given number (usually, the ID of an entry in a database). Sometimes I've done this by hand. But with Enumerable.Range
, generating a list like this makes for a nice snippet of C# code.
var startingPoint = 999; // or wherever you want to start
var size = 10;
var list = Enumerable.Range(startingPoint-(size / 2), size);