KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to implement an expression for a method like here: var prop = Expression.Property(someItem, "Name"); var value = Expression.Constant(someConstant); var contains = typeof(string).GetMethod("Contains", new[] {typeof(string)}); var expression = Expression.Call(prop, contains, value); But for my extension method: public static class StringEx { public static bool Like(this string a, string b) { return a.ToLower().Contains(b.ToLower()); } } Unfortunately, next code throws an ArgumentNullException for a parameter "method": var like = typeof(string).GetMethod("Like", new[] {typeof(string)}); comparer = Expression.Call(prop, like, value); What I'm doing wrong?
Tags (comma-separated)
Save Edits
Cancel