Skip to content

Instantly share code, notes, and snippets.

@palfrey
Created May 23, 2011 22:03
Show Gist options
  • Select an option

  • Save palfrey/987722 to your computer and use it in GitHub Desktop.

Select an option

Save palfrey/987722 to your computer and use it in GitHub Desktop.
Build your own Expression's
var lam = Expression.Lambda<Func<string, bool>>
(
Expression.Call
(
Expression.Invoke(
Expression.Lambda
(
Expression.Call
(
paramExpr,
typeof (String).GetMethod("ToLower", new Type[] {})
),
new List<ParameterExpression>{paramExpr}
),
new List<ParameterExpression>{paramExpr}
),
typeof(String).GetMethod("Contains", new [] { typeof(string) }),
new Expression[]
{
Expression.Constant(query.ToLower())
}
),
new List<ParameterExpression>{paramExpr}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment