Define the reverse order query : Order « LINQ « VB.Net






Define the reverse order query

  

Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Globalization

Module Example
   Public Sub Main()

      Dim TestArray As Integer() = New Integer() {1, 2, 3, 4, 5, 6, 7, 8}
      Dim ThisQuery = From ThisElement In TestArray Select ThisElement Skip 4
      For Each TheResult In ThisQuery
         Console.WriteLine(TheResult.ToString())
      Next
      ' Define the reverse order query.
      ThisQuery = From ThisElement In TestArray _
                  Order By ThisElement Descending _
                  Select ThisElement Skip 4 _
                  Order By ThisElement

      
      For Each TheResult In ThisQuery
         Console.WriteLine(TheResult.ToString())
      Next




   End Sub 
End Module 

   
    
  








Related examples in the same category

1.Order all the cars by PetName
2.Order by two properties
3.Two order By clauses
4.Compound Order By: Descending then Ascending
5.Order By Descending
6.Compound Order By (two conditions)
7.Compound Order By Ascending then Descending
8.Reverse Ordering