IQueryable throw "The specified argument is out of range.
the code:
public IQueryable<T> ApplyOrder(IQueryable<T> items, GridSortDirection direction)
{
switch (direction)
{
case GridSortDirection.Ascending:
return items.OrderBy(_expression);
case GridSortDirection.Descending:
return items.OrderByDescending(_expression);
}
}
where _expression is a type:
Expression<Func<T, TKey>> expression
and this
{x => x.customers.studentschoolenrolments.ElementAt(0).schools.Name}
I do not want this release. Is it possible to check if an element exists and not return an empty string?
I am trying to use a method like:
public static bool IsNullOrEmpty<T>(this IEnumerable<T> items) {
return items == null || !items.Any();
}
but I have no idea how to use it in items.OrderBy(_expression);
source
share