daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static IQueryable<T> Select<T>(IQueryable<T> queryable, IEnumerable<string> columns)
  2.     {
  3.         LambdaExpression lambda = DynamicExpression.ParseLambda(queryable.ElementType, null, $"new ({string.Join(",", columns)})", queryable);
  4.  
  5.         MethodCallExpression select = Expression.Call(typeof(Queryable), "Select", new Type[] { queryable.ElementType, lambda.Body.Type }, Expression.Constant(queryable), Expression.Quote(lambda));
  6.         return queryable.Provider.CreateQuery<T>(select);
  7.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top