I am trying to order a set of numbers in Linq.
var columns = source.Select(columnSelector).Distinct().OrderBy(x => x?
x => x in intellisense only has normal object selections (Equals, GetHashCode, GetType and ToString).
columnsSelector is passed as: "Func<T, TColumn>". This is just a list of numbers or strings that will become the columns names in a pivot.
It works fine, but not sorted. So I end up with: 1, 3, 2, 4. I want to order this so wanted to add the "OrderBy" to the code, but I can't seem to get a value for the Lambda expression that OrderBy expects.
How would I solve this?
Thanks,
Tom
var columns = source.Select(columnSelector).Distinct().OrderBy(x => x?
x => x in intellisense only has normal object selections (Equals, GetHashCode, GetType and ToString).
columnsSelector is passed as: "Func<T, TColumn>". This is just a list of numbers or strings that will become the columns names in a pivot.
It works fine, but not sorted. So I end up with: 1, 3, 2, 4. I want to order this so wanted to add the "OrderBy" to the code, but I can't seem to get a value for the Lambda expression that OrderBy expects.
How would I solve this?
Thanks,
Tom