Generic Lambda Query Builder
suggest changeRemarks
The class is called ExpressionBuilder. It caches three MethodInfo values:
private static readonly MethodInfo ContainsMethod = typeof(string).GetMethod("Contains", new[] { typeof(string) });
private static readonly MethodInfo StartsWithMethod = typeof(string).GetMethod("StartsWith", new[] { typeof(string) });
private static readonly MethodInfo EndsWithMethod = typeof(string).GetMethod("EndsWith", new[] { typeof(string) });
One public method, GetExpression, returns the lambda expression. Three private methods support it:
Expression GetExpression<T>BinaryExpression GetExpression<T>ConstantExpression GetConstant
The examples explain each method.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents