I have a list which I am currently sorting manually by using .OrderBy
:
var newList = pouchList
.OrderBy(x => x.ID3Val)
.ThenBy(x => x.ID4Val == "LATE")
.ThenBy(x => x.ID4Val == "BED")
.ThenBy(x => x.ID4Val == "TEA")
.ThenBy(x => x.ID4Val == "LNCH")
.ThenBy(x => x.ID4Val == "MORN")
.ToList();
What I would like to do is have the parameters to which the list is ordered by in an array ie:
[ "LATE", "BED", "TEA", "LNCH", "MORN" ]
so that I can change the array and have the list sorted dynamically using these parameters.
Does anyone know if this is possible?