Forum C# sorting array of DatabaseObjects

sorting array of DatabaseObjects

Postby Pawel Wozniak » November 28th, 2015, 7:48 am

How to sort array of database objectsusing one of object fields ("_lastModificationDate") ? Ican`t do this sorting in loading query because i can specify only one range parameter in compound indexes...
Pawel Wozniak
Paid Member
 
Posts: 96
Joined: October 14th, 2012, 10:47 pm

Re: sorting array of DatabaseObjects

Postby Henrik » December 1st, 2015, 12:29 am

Code: Select all
Array.Sort(objects, (a, b) => a.GetDateTime("_lastModificationDate").CompareTo(b.GetDateTime("_lastModificationDate")));


(If you want descending order, swap a and b in the sort expression)
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to C#



cron