Generic Lambda Query Builder

suggest change

Remarks

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:

The examples explain each method.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents