Releases: zzzprojects/Eval-Expression.NET
Releases · zzzprojects/Eval-Expression.NET
v2.7.2
v2.7.1
Download the library here
- ADDED:
IsExpressionValueproperty to theVariableFactoryArgument. When true, a parameter will no longer be used from the value, the expression will be returned directly. This new option allows creating dictionary value on the fly.
var variables = new Dictionary<string, object>();
var eval = new EvalContext();
eval.VariableFactory = argument =>
{
variables[argument.Name] = 2;
argument.IsHandled = true;
argument.IsExpressionValue = true;
var dict = Expression.Constant(variables);
var dictionaryItemPropertyInfo = typeof(IDictionary).GetProperty("Item", new[] { typeof(string) });
Expression innerExpression = Expression.Property(dict, dictionaryItemPropertyInfo, Expression.Constant(argument.Name));
argument.Value = Expression.Convert(innerExpression, typeof(int));
};
eval.Execute("x = 0; x = 6 + x;", variables);
var value = variables["x"];
var counter = variables.Count;Trial unlocked for the current month (July)
v2.7.0
Download the library here
- ADDED: Code Compiler now return additional information when an exception happens
- ADDED: Using one dictionary + parameter from key now change dictionary value
- ADDED: Using ExpandoObject + parameter from key now change ExpandoObject value
var variables = new Dictionary<string, object>();
variables.Add("x", 0);
Eval.Execute("x = 2;", variables);
var x2 = variables["x"];dynamic expandoObject = new ExpandoObject();
expandoObject.x = 2;
Eval.Execute("x = 0;", expandoObject);
var x = expandoObject.x;Trial unlocked for the current month (July)
v2.6.5
v2.6.3
v2.6.2
Download the library here
ADDED: Support to nullable when using directly dictionary key for a null value
var data = new Dictionary<string, double?> { { "A", 2 }, { "B", 3 }, { "C", null } };
var result = Z.Expressions.Eval.Execute<double?>("A + B + C.GetValueOrDefault(0)", data);Trial unlocked for the current month (May)
v2.5.0
v2.4.21
Download the library here
ADDED: VariableFactory event (Assign variable value on the fly)
var context = new EvalContext();
context.VariableFactory = arg =>
{
var name = arg.Name;
if (name == "X")
{
arg.Value = 2;
arg.IsHandled = true;
}
else if (name == "Y")
{
arg.Value = 3;
arg.IsHandled = true;
}
};
var r = context.Execute("X + Y");Trial unlocked for the current month (March)