public static IEnumerable <TR> MapList <T, TR>(this IEnumerable <T> lst) where T : class where TR : class { Expression <Func <T, TR> > expression = QueryMapper.GetExpression <T, TR>(); if (lst is IQueryable <T> ) { ((IQueryable <T>)lst).Select(expression).ToList(); } return(lst.Select(expression.Compile()).ToList()); }
public static IEnumerable <TR> MapList <T, TR>(this IQueryable <T> lst) where T : class where TR : class { return(lst.Select(QueryMapper.GetExpression <T, TR>()).ToList()); }