Reverse a Range in CSharp

Description

The following code shows how to reverse a Range.

Example


    //ww  w . ja va 2  s  .  c  o m

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

    class MainClass
    {
        static void Main()
        {
            var collection = Enumerable.Range(0, 10).Reverse();

            foreach (var element in collection)
            {
                Console.WriteLine(element);
            }
        }
    }

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ