I have List<Tuple<string[], SolidColor>> ExcelData as my list.
I can order ExcelData with LINQ's functions OrderBy and ThenBy and add EmptyStringsAreLast function to OrderBy which I found from this guy (https://stackoverflow.com/a/14641992/11848085).
Code looks like this:
ExcelData = ExcelData
.OrderBy(arr => arr.Item1[2], new EmptyStringsAreLast())
.ThenBy(arr => arr.Item1[1])
.ThenBy(arr => arr.Item1[0])
.ToList();
That works as long as I don't want to use dynamic OrderBy. If I use dynamic OrderBy, like this one (This one requires System.Linq.Dynamic or System.Linq.Dynamic.Core), I can't possible figure out any way possible to add that EmptyStringsAreLast() function to that first argument (Item1[2] ASC). (https://stackoverflow.com/a/8660293)
ExcelData = ExcelData.AsQueryable()
.OrderBy("Item1[2] ASC, Item1[1] ASC, Item1[0] ASC")
.ToList();
Is there a way to do something like this?
ExcelData = ExcelData.AsQueryable()
.OrderBy("'Item1[2] ASC, new EmptryStringsAreLast()', Item1[1] ASC, Item1[0] ASC")
.ToList();