Click here to Skip to main content
15,569,696 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am trying to use the dynamic LINQ expression builder from

However the I am not sure how to make the "equals" operation case insensitive.

case GridHelper.Operator.Equals:
return Expression.Equal(member, constant);

I want the above to be case insensitive either convert both to lower case or upper case, does not matter.

Pls. any helpful pointers appreciated.

George Swan 23-Jul-15 1:30am    
Have a look at this link

Look at[^] where you can specify the method (MethodInfo) to implement the actual Equality comparison.
Share this answer

What about converting the strings ToLower or ToUpper before sending them to the Equal expression? Something like:

return Expression.Equal(member.ToString().ToLower(), constant.ToString().ToLower());
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900