OrderByDescending method (with integers)

Description

The OrderByDescending method sorts the elements of a sequence in ascending order.

Sample

This sample sort a list of integers in descending order.

var data := List<int>{} { 5, 3, 1, 2, 4 }

var result := data:OrderByDescending({ q => q })

foreach var item in result 
   Console.WriteLine(item)
next

Output

5
4
3
2
1

Complete sample

using System
using System.Linq
using System.Collections.Generic

procedure Execute() as void strict

   var data := List<int>{} { 5, 3, 1, 2, 4 }

   var result := data:OrderByDescending({ q => q })

   foreach var item in result 
      Console.WriteLine(item)
   next
   return

var data := List<int>{} { 5, 3, 1, 2, 4 }

var result := from q in data ;
              orderby q descending;
              select q

foreach var item in result 
   Console.WriteLine(item)
next

Output

5
4
3
2
1

Complete sample

using System
using System.Linq
using System.Collections.Generic

procedure Execute() as void strict

   var data := List<int>{} { 5, 3, 1, 2, 4 }

   var result := from q in data ;
                 orderby q descending;
                 select q

   foreach var item in result 
      Console.WriteLine(item)
   next
   return