c# - Case-insensitive Func -


i have func<message, bool> message class of mine.

i build lambda , compile func<message,bool>

public static func<classes.message, bool> getpredicate(string expression) {     func<classes.message, bool> result = null;      try     {         parameterexpression parameter = expression.parameter(typeof(classes.message), "message");         var lambda = dynamicexpression.parselambda(new[] { parameter }, null, expression);         result = lambda.compile() func<classes.message, bool>;     }     catch (exception e)     {         _log.fatal(e);     }      return result; } 

this results in

message => (((message.containsproperty("gender") == true) andalso (message.getpropertyvalue("gender") != "female")) andalso (message.channelstring != "facebookcomment")) 

later on, func gets executed i'd make case-insensitve when message objet gets passed in gender "female" not "female" still returns true in bool.

is possible?

thanks

use toupper().

message.getpropertyvalue("gender").toupper() != "female" 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -