Let's say I have a class called Order, for each order of burgers I do at a burger restaurant. I have an array of all the orders that have been placed today (Order[]) called orderstoday I want to sort orderstoday[] by the time each order have been placed, which can be obtained by Order.timestamp. How do I do this? Thanks.
Asked
Active
Viewed 76 times
0
-
Please show the classes and the structure – Arion May 30 '17 at 06:34
-
What you have tried so far ? – Eldho May 30 '17 at 06:35
-
Note that the question mentions alphabetical sort; however, the answers there will also solve your problem of sorting by date. – Rob May 30 '17 at 06:35
-
using System.Linq; orders.OrderBy(order=>order.TimeStamp) You can check this page http://www.tutorialsteacher.com/linq/linq-sorting-operators-orderby-orderbydescending – Miguel May 30 '17 at 06:37
-
thanks miguel that helped me – May 30 '17 at 09:39