Enumerable.Range : Enumerable « System.Linq « C# / C Sharp by API






Enumerable.Range

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        var numbers =
           from n in Enumerable.Range(100, 50)
           select new { Number = n, OddEven = n % 2 == 1 ? "odd" : "even" };

        foreach (var n in numbers) {
            Console.WriteLine("The number {0} is {1}.", n.Number, n.OddEven);
        }
    }
}

   
  








Related examples in the same category

1.Enumerable.Aggregate
2.Enumerable.Average()
3.Enumerable.Cast
4.Enumerable.Count()
5.Enumerable.DefaultIfEmpty
6.Enumerable.Distinct()
7.Enumerable.ElementAt
8.Enumerable.ElementAtOrDefault
9.Enumerable.ElementsAfterSelf
10.Enumerable.Empty
11.Enumerable.First
12.Enumerable.OrderBy
13.Enumerable.Repeat
14.Enumerable.Where