Replies: 1 comment
-
I don't know if I correctly follow your use case but you can supply values however you like to expressions. For example using something like you have above: class NewObject
{
public int A { get; set; }
public int B { get; set; }
}
var expression = new Expression("[a] + [b]");
var myObject = new Object
{
A = 10,
B = 20
};
expression.Evaluate(
new Dictionary<string, object>
{
["a"] = myObject.A,
["b"] = myObject.B
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want it support sub object property, it can help us to organize our input params;
such as [a] + [b]
=>
class NewObject{
public int a
public int b;
}
then we can change the expression [a] + [b] to [theObject_A.a] + [theObject_B.b]
and you can view Drools solution , you may get my words.
Beta Was this translation helpful? Give feedback.
All reactions