I'm trying to use IComparer with a generic type.
The code below generates the following error: "The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly."
If I remove the custom comparer from the OrderBy call then the code compiles and orders fine, however I need to be able to pass in my icomparer. Also worth noting is that the code below works if i use type of object/string etc. but fails when I try and use generic type
public IQueryable<T> OrderResults<T, TU>(IQueryable<T> queryData, IComparer<TU> customComparer, string sortColumnName)
{
var sortPropertyInfo = queryData.First().GetType().GetProperty(sortColumnName);
return queryData.OrderBy(x => sortPropertyInfo.GetValue(x, null), customComparer);
}