I have the following
List<WorkItemHeader>
WorkItemWorkItemHeader(string company, string division, string customerNumber, string imgCode, int sequence, string orderNumber, int lineNumber, DateTime importDate, int processType, int operatorID, int typeset, string product)
I would like to order my list by multiple properties (by Division, ImportDate, OrderNumber, LineNumber)
Division contains (ABC, XYZ, DEF, HIJ)
My requirement (and question) is, Division needs to be sorted by Division containing: (XYZ, ABC) first then by ImportDate, OrderNumber, LineNumber.
MySql has FIELD()
ORDER BY FIELD(position,'forward', 'midfielder', 'defender', 'goalkeeper')
T-SQL has CASE WHEN
ORDER BY CASE Position WHEN "forward" THEN 1
WHEN "defender" THEN 2
WHEN "midfielder" THEN 3
WHEN "goalkeeper" THEN 4 END
How can I simulate the sorting using Linq?