Range Projection : Range « LINQ « C# / CSharp Tutorial






using System;
using System.ComponentModel;
using System.Linq;

    class MainClass
    {
        static void Main()
        {
            var collection = Enumerable.Range(0, 10)
                                       .Where(x => x % 2 != 0)
                                       .Reverse()
                                       .Select(x => new { Original = x, SquareRoot = Math.Sqrt(x) });

            foreach (var element in collection)
            {
                Console.WriteLine("sqrt({0})={1}",
                                  element.Original,
                                  element.SquareRoot);
            }
        }
    }








22.59.Range
22.59.1.Range Cartesian Join
22.59.2.Range Enumeration
22.59.3.Range Filtering
22.59.4.Range Ordering
22.59.5.Range Projection
22.59.6.Range Reversal