I want to get the value of a list. My method like this:
private void predicateTest(Expression<Func<bool>> predicate)
{
var body = predicate.Body;
var binaryExpression = body as BinaryExpression;
var binaryBody= binaryExpression ??
Expression.MakeBinary(ExpressionType.Equal,
body, Expression.Constant(true));
var left = binaryBody.Left;
}
And my calling:
List<string> list = new List<string> { "doc", "exe", "jpg" };
predicateTest(() => list.Contains("sdf"));
And predicate.Body.Left value like following picture. How to get value of list as programmatic in predicateTest method?
Aucun commentaire:
Enregistrer un commentaire