OrderBy 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 ascending order.

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

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

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

Output

1
2
3
4
5

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:OrderBy({ 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 ;
              select q

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

Output

1
2
3
4
5

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 ;
                 select q

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