Introduction

Problem

You are looking for an expression evaluator, but you are not sure which library to try/choose.

Solution

There is hundreds of expression evaluator libraries, the most common are:

Example – Eval-Expression.NET

// using Z.Expressions; // Don't forget to include this.

var result = Eval.Execute("X*Y", new { X = 2, Y = 3 }); // return 6

Comparisons

Features Eval-Expression.NET Expression Evaluator FLEE NCalc
Documentation :star::star::star::star::star::star::star::star::star::star::star::star::star::star:
Support :star::star::star::star::star::star::star::star::star:
`1-1` :whitecheckmark::x::whitecheckmark::whitecheckmark:
`1+(long)1` :whitecheckmark::whitecheckmark::x::x:
`1+1u` :whitecheckmark::whitecheckmark::whitecheckmark::x:
Anonymous Type :whitecheckmark::x::x::x:
Extensions Methods :whitecheckmark::x::x::x:
Lambda Expressions :whitecheckmark::x::x::x:
LINQ :whitecheckmark::x::x::x:
Methods Overloads :whitecheckmark::x::x::x:

Reviews

Eval-Expression.NET

Eval-Expression.NET is the most advanced expression evaluator. The library is the easiest to use and have an outstanding customer support. The library is even ahead of Roslyn for some features like String Interpolation.

The library is FREE up to 50 characters.

Other Open Source Libraries

Free Open Source library has their advantage (being free) but also their disadvantage:

  • Fail on simple expression
  • Limited & Outdated
  • Weak or no support

Conclusion

It’s hard to recommend another library for production environment other than Eval-Expression.NET. Soon or later with other free third-party library, you will hit a wall with an expression, and you will have to switch to a more complete solution.