EasyExpression 1.0.4
dotnet add package EasyExpression --version 1.0.4
NuGet\Install-Package EasyExpression -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyExpression" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyExpression --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasyExpression, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasyExpression as a Cake Addin #addin nuget:?package=EasyExpression&version=1.0.4 // Install EasyExpression as a Cake Tool #tool nuget:?package=EasyExpression&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasyExpression
依赖
- .netstandard 2.0
支持的功能
- 逻辑运算
- 算术运算
- 条件运算
- 函数嵌入
- 优先级解构
- 外部传入实参
函数扩展
在EasyExpression.FormulaAction下可以实现更多函数
逻辑运算
0d 表示 false 1d 表示 true
示例
- 逻辑表达式
var expStr = "3 * (1 + 2) < != 5 || !(8 / (4 - 2) > [SUM](1,2,3))";
// 解析表达式树
var exp = new Expression(expStr);
// 把表达式中的数据加载到表达式对应的节点
exp.LoadArgument();
// 按表达式树逐级执行结果
var value = exp.Excute();
var expStr = "a * (b + c) > d & [Contains](srcText,text)";
var dic = new Dictionary<string, string>
{
{ "a","3"},
{ "b","1"},
{ "c","2"},
{ "d","4"},
{ "srcText","abc"},
{ "text","bc"},
};
var exp = new Expression(expStr);
exp.LoadArgument(dic);
var value = exp.Excute();
- 算术表达式
var expStr = "3 * (1 + 2) + 5 - (30 / (4 - 2) % [SUM](1,2,3))";
var exp = new Expression(expStr);
exp.LoadArgument();
var value = exp.Excute();
- 外部传入实参
var expStr = "a * (b + c) + 5 - (30 / (d - 2) % [SUM](1,2,3))";
var dic = new Dictionary<string,string>
{
{ "a","3"},
{ "b","1"},
{ "c","2"},
{ "d","4"},
};
var exp = new Expression(expStr);
// 外部实参注入到表达式树中
exp.LoadArgument(dic);
var value = exp.Excute();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1. 新增TimeSpan的支持
2. 优化函数的参数转换
3. 修复负号误识别的bug