I have created a function that has the follwing parameter:
List>> orderBy = null
T
Two problems; firstly, ThanBy
should be ThenBy
; secondly, ThenBy
is only available on the generic type, IOrderedQueryable
.
So change to:
IOrderedQueryable temp = null;
foreach (Expression> func in orderBy) {
if (temp == null) {
temp = catalogProducts.OrderBy(func);
} else {
temp = temp.ThenBy(func);
}
}
and you should be sorted.