Repository navigation
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
}); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
All reactions