NTDLS.ExpressionParser 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NTDLS.ExpressionParser --version 1.0.0
                    
NuGet\Install-Package NTDLS.ExpressionParser -Version 1.0.0
                    
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="NTDLS.ExpressionParser" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NTDLS.ExpressionParser" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NTDLS.ExpressionParser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NTDLS.ExpressionParser --version 1.0.0
                    
#r "nuget: NTDLS.ExpressionParser, 1.0.0"
                    
#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.
#:package NTDLS.ExpressionParser@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NTDLS.ExpressionParser&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NTDLS.ExpressionParser&version=1.0.0
                    
Install as a Cake Tool

NTDLS.ExpressionParser

Expression parser for .net. Supports expression nesting, custom variables, custom functions as well as a ton of built in functions.

Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.ExpressionParser/

Simple example:

In this example we will create an expression that uses two built in functions "Ceil" and "Sum", a custom function called "DoStuff" and one variable called "extra". You can also pass a configuration parameter to set max memory size, cache scavange rate and partition count.


var expression = new Expression("10 * ((5 + extra + DoStuff(11,55) + ( 10 + !0 )) * Ceil(SUM(11.6, 12.5, 14.7, 11.11)) + 60.5) * 10");

//Add a value for the variable called "extra".
expression.AddParameter("extra", 1000);

//Handler for the custom function:
expression.AddFunction("DoStuff", (double[] parameters) =>
{
	double sum = 0;
	foreach (var parameter in parameters)
	{
		sum += parameter;
	}
	return sum;
});

var result = ExpressionParser.Evaluate(expression);

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.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.

Version Downloads Last Updated
1.5.4 191 2 days ago
1.5.3 173 17 days ago
1.5.2 174 17 days ago
1.5.1 171 19 days ago
1.5.0 171 19 days ago
1.4.2 173 20 days ago
1.4.1 168 20 days ago
1.4.0 161 21 days ago
1.3.2 122 21 days ago
1.3.1 125 21 days ago
1.3.0 120 21 days ago
1.2.0 91 22 days ago
1.1.5 217 12/31/2024
1.1.4 186 10/3/2024
1.1.3 185 10/3/2024
1.1.2 306 11/15/2023
1.1.1 231 10/17/2023
1.1.0 229 10/16/2023
1.0.0 209 10/13/2023

Initial public release.