This project is read-only.

String comparison not workig


public class Test
public int Queue {get;set;}

public string Name{get;set;}

var obj =new Test{Queue =20, Name="Santhosh"};
var exp = "(Test self")=> self.Queue > 10 && self.Name==""Santhosh""";
var parser = new ExprParser();
bool result = (bool)parser.Parse(exp).Compile().DynamicInvoke(obj);

you will get below error:
No coercion operator is defined between types 'System.Boolean' and 'System.String'


sageikosa wrote Jan 13, 2015 at 4:05 PM

Not sure if anyone else has hit this, but ExprParser.cs line 745 needs an open parenthesis after the &&, and an extra closing parenthesis at the end of the line. Basically without that, any expression with a string as the second parameter becomes a string concatenation.