Skip to content

3. OrderBy

IharYakimush edited this page Mar 1, 2018 · 1 revision

Usings

    using System;
    using System.Linq;

    using Community.OData.Linq;

Order by simple property

Code

IQueryable<Sample> dataSet = Sample.CreateQuerable();
ample[] filterResult = dataSet.OData().OrderBy("Id desc,Name asc").ToArray();

foreach (Sample sample in filterResult)
{
    Console.WriteLine("Id:{0} Name:{1}", sample.Id, sample.Name);
}

Console output

Id:3 Name:name3
Id:2 Name:name2
Id:1 Name:name1
Clone this wiki locally