NCalcSync.signed
6.1.0
dotnet add package NCalcSync.signed --version 6.1.0
NuGet\Install-Package NCalcSync.signed -Version 6.1.0
<PackageReference Include="NCalcSync.signed" Version="6.1.0" />
<PackageVersion Include="NCalcSync.signed" Version="6.1.0" />
<PackageReference Include="NCalcSync.signed" />
paket add NCalcSync.signed --version 6.1.0
#r "nuget: NCalcSync.signed, 6.1.0"
#:package NCalcSync.signed@6.1.0
#addin nuget:?package=NCalcSync.signed&version=6.1.0
#tool nuget:?package=NCalcSync.signed&version=6.1.0
NCalc
NCalc is a fast, lightweight expression evaluator for .NET. It parses and evaluates mathematical and logical expressions with literals, operators, parameters, built-in functions, and custom functions.
NCalc targets modern .NET, .NET Standard 2.0, and .NET Framework 4.8.
Documentation
Start with the NCalc docs for the full language reference, runtime options, plugins, and API reference.
Useful entry points:
Install
Use NCalc.Core for the expression engine:
dotnet add package NCalc.Core
NCalcSync and NCalcAsync are obsolete redirect packages. Use NCalc.Core directly.
Add optional packages only when you need them:
dotnet add package NCalc.LambdaCompilation
dotnet add package NCalc.DependencyInjection
Quick Examples
Evaluate an expression
using NCalc;
var result = new Expression("2 + 3 * 5").Evaluate();
// 17
Use parameters
var expression = new Expression("Round(Pow([x], 2) + [offset], 2)");
expression.Parameters["x"] = 3.14;
expression.Parameters["offset"] = 10;
var result = expression.Evaluate();
// 19.86
Add custom functions
var expression = new Expression("SecretOperation(3, 6)");
expression.Functions["SecretOperation"] = args =>
(int)args.Evaluate(0) + (int)args.Evaluate(1);
var result = expression.Evaluate();
// 9
Compile to a lambda
Install NCalc.LambdaCompilation first.
using NCalc.LambdaCompilation;
var expression = new Expression("1 + 2");
Func<int> function = expression.ToLambda<int>();
var result = function();
// 3
For data types, operators, built-in functions, async evaluation, caching, expression serialization, and advanced configuration, check the docs.
Help
Open an issue for bugs or usage problems. Include the expression, the expected result, the actual result, and your NCalc version.
For discussion, support, and project news, join the Discord server.
Learn More
Related Projects
| Project | Description |
|---|---|
| FastExpressionCompiler | Fast compiler for C# expression trees. NCalc uses it for lambda compilation. |
| Jint | JavaScript interpreter for .NET by Sebastien Ros, the original author of NCalc. |
| JJMasterData | Runtime form generator that uses NCalc for field visibility and other dynamic behavior. |
| NCalc101 | Web application for trying NCalc expressions, developed by Panoramic Data. |
| NCalcJS | TypeScript/JavaScript port of NCalc. |
| PanoramicData.NCalcExtensions | Extension functions for NCalc, including string functions, switch, if, in, typeOf, and cast. |
| Parlot | Fast and lightweight parser creation tools by Sebastien Ros. NCalc uses Parlot in its default parser. |
Using NCalc? Create a PR and add your project here!
Versioning
NCalc uses Nerdbank.GitVersioning. Each library build can be traced back to the original git commit. Read more in the release documentation.
Star History
<a href="https://star-history.com/#ncalc/ncalc&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ncalc/ncalc&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ncalc/ncalc&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ncalc/ncalc&type=Date" /> </picture> </a>
| 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 is compatible. 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 is compatible. 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. |
| .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 is compatible. 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. |
-
.NETFramework 4.6.2
- NCalc.Core (>= 6.1.0)
-
.NETStandard 2.0
- NCalc.Core (>= 6.1.0)
-
net10.0
- NCalc.Core (>= 6.1.0)
-
net8.0
- NCalc.Core (>= 6.1.0)
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 |
|---|---|---|
| 6.1.0 | 0 | 6/7/2026 |
| 6.0.0 | 44 | 6/6/2026 |
| 5.13.0 | 95 | 6/4/2026 |
| 5.12.0 | 2,198 | 2/19/2026 |
| 5.11.0 | 5,249 | 12/19/2025 |
| 5.10.0 | 317 | 12/18/2025 |
| 5.9.0 | 891 | 12/2/2025 |
| 5.8.0 | 611 | 11/4/2025 |
| 5.7.0 | 1,045 | 9/22/2025 |
| 5.6.0 | 5,828 | 8/3/2025 |
| 5.5.0 | 375 | 7/9/2025 |
| 5.5.0-alpha | 264 | 2/14/2025 |
| 5.4.2 | 1,325 | 4/29/2025 |
| 5.4.1 | 1,963 | 2/14/2025 |
| 5.4.0 | 254 | 2/14/2025 |
| 5.3.1 | 1,232 | 12/18/2024 |
| 5.3.0 | 562 | 11/16/2024 |
| 5.2.11 | 3,624 | 10/25/2024 |
| 5.2.10 | 7,043 | 10/7/2024 |
| 5.2.9 | 315 | 9/26/2024 |