Releases: datchung/ExpressionEvaluator
Releases · datchung/ExpressionEvaluator
Bug Fix
Operator Mapping
Support operator mapping.
Example:
ExpressionEvaluator.SetOperatorMap(new Dictionary<string, string>
{
{"+", "plus"},
{"*", "times"},
{"/", "divideBy"},
});
// Returns 6
int result = ExpressionEvaluator.Evaluate<int>("(1 plus 2) times 2");
Initial Release
ExpressionEvaluator
Simple expression evaluator for C#
Getting Started
- Install via nuget:
ExpressionEvaluatorCs
https://www.nuget.org/packages/ExpressionEvaluatorCs/ - Sample code
// Returns 6
object result1 = ExpressionEvaluator.Evaluate("(1 + 2) * 2");
// Returns false
object result2 = ExpressionEvaluator.Evaluate("false and true");
.NET Support
- Current Release: .NET Framework 4
- Future release: .NET Core (.NET Standard Library)
Expression Support
- And
- False
- Not
- Or
- True
Operator Support
- <
- >
- <=
- >=
- <>
- =
- +
- -
- *
- /
- %
Options
Specify Return Type
Sample code
// Returns 6
int result1 = ExpressionEvaluator.Evaluate<int>("(1 + 2) * 2");
// Returns false
bool result2 = ExpressionEvaluator.Evaluate<bool>("false and true");
Specify Operator Mapping
TBD