- Notifications
You must be signed in to change notification settings - Fork86
C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
License
zzzprojects/Eval-Expression.NET
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Eval Expression.NET improves performance dramatically to access public and private methods, field, property value, or create object instances overusing C# reflection.
It allows you to evaluate, Compile and Execute dynamic C# code and expression at runtime.
From simple C# math expression...
// @nuget: Z.Expressions.EvalusingZ.Expressions;intresult=Eval.Execute<int>("X + Y",new{X=1,Y=2});
To complex code to parse.
// @nuget: Z.Expressions.EvalusingZ.Expressions;intresult=Eval.Execute<int>(@"var list = new List<int>() { 1, 2, 3, 4, 5 };var filter = list.Where(x => x < 4);return filter.Sum(x => x);");
PM> Install-Package Z.Expressions.Eval* PRO Version unlocked for the current month
Evaluate and execute the code or expression.
Support:
Anonymous Class
// @nuget: Z.Expressions.EvalusingZ.Expressions;intresult=Eval.Execute<int>("X + Y",new{X=1,Y=2});
Argument Position
// @nuget: Z.Expressions.EvalusingZ.Expressions;intresult=Eval.Execute<int>("{0} + {1}",1,2);
Class Member
// @nuget: Z.Expressions.EvalusingZ.Expressions;dynamicexpandoObject=newExpandoObject();expandoObject.X=1;expandoObject.Y=2;intresult=Eval.Execute<int>("X + Y",expandoObject);
Extension Methods
// @nuget: Z.Expressions.EvalusingZ.Expressions;strings="X + Y";intresult=s.Execute<int>(new{X=1,Y=2});
Compile the code or expression and return a delegate.
Support:
Custom Delegate
// @nuget: Z.Expressions.EvalusingZ.Expressions;varcompiled=Eval.Compile<Func<int,int,int>>("X + Y","X","Y");foreach(variteminlist){intresult=compiled(item.Value1,item.Value2);}
Extension Methods
// @nuget: Z.Expressions.EvalusingZ.Expressions;strings="X + Y";varcompiled=s.Compile<Func<int,int,int>>("X","Y");foreach(variteminlist){intresult=compiled(item.Value1,item.Value2);}
Eval Expression.NET supports all C# Syntax:
- All C# Keywords (MSDN Documentation)
- All C# Operators (MSDN Documentation)
- Constant Folding
- Extension Methods
- Generic Type
- Lambda Expression
- Number Suffix
You can even access C# 6.0 features even if you are using C# 4.0.
- string interpolation
- typename
- null conditional member access
Every month, a new monthly trial of the PRO Version is available to let you evaluate all its features without limitations.
| Features | PRO Version |
|---|---|
| Maximum Characters | Unlimited |
| Commercial License | Yes |
| Royalty-Free | Yes |
| Support & Upgrades (1 year) | Yes |
| Learn more about thePRO Version |
- Starting from version 2.x, there is no longer a free limited version.
LINQextension method is free withEF Classic - Community
The best way to contribute is byspreading the word about the library:
- Blog it
- Comment it
- Star it
- Share it
AHUGE THANKS for your help.
- Projects:
- Learn Websites
- Online Tools:
- and much more!
To view all our free and paid projects, visit our websiteZZZ Projects.
About
C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.