Expressions value evaluvation
I'm trying to create expression trees using Linq.Expressions and evaluvate them at 开发者_高级运维runtime.I was wondering if there's a way to populate values based on the operator.
Example:
My expression is : (x<=100) && (50!=y)
.What can be the values of x
and y
? For a true and false scenario? Is there a way to find them using Expression
object?
I don't believe this is going to be trivial to do!
One thing you might find interesting is the Pex research project from Microsoft - http://research.microsoft.com/en-us/projects/pex/ This is used in the pex whitebox testing plugin and in the fun http://www.pexforfun.com/ site. While not exactly your problem, I believe they do use heuristics (and some blind "trial-and-error" guesses) to try to find boundary cases for testing.
精彩评论