Use Generation Operators : Enumerable.Range : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Enumerable.Range »

 

Use Generation Operators








    
 

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);
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Enumerable.Range