Using Range with various Linq methods C# with Example
You can use the Enumerable class alongside Linq queries to convert for loops into Linq one liners. Select Example Opposed to doing this: var asciiCharacters = new List(); for (var x = 0; x < 256; x++) { asciiCharacters.Add((char)x); } You can do this: var asciiCharacters = Enumerable.Range(0, 256).Select(a => (char) a); Where Example In this example, 100 numbers will be generated and even ones will be extracted var evenNumbers = Enumerable.Range(1, 100).Where(a => a % 2 == 0);