![]() |
VOOZH | about |
dotnet add package NCalcSync --version 6.2.0
NuGet\Install-Package NCalcSync -Version 6.2.0
<PackageReference Include="NCalcSync" Version="6.2.0" />
<PackageVersion Include="NCalcSync" Version="6.2.0" />Directory.Packages.props
<PackageReference Include="NCalcSync" />Project file
paket add NCalcSync --version 6.2.0
#r "nuget: NCalcSync, 6.2.0"
#:package NCalcSync@6.2.0
#addin nuget:?package=NCalcSync&version=6.2.0Install as a Cake Addin
#tool nuget:?package=NCalcSync&version=6.2.0Install as a Cake Tool
👁 GitHub Actions Workflow Status
👁 Coverage
👁 NuGet
👁 NuGet Downloads
👁 Discord
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.
Start with the NCalc docs for the full language reference, runtime options, plugins, and API reference.
Useful entry points:
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
using NCalc;
var result = new Expression("2 + 3 * 5").Evaluate();
// 17
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
var expression = new Expression("SecretOperation(3, 6)");
expression.Functions["SecretOperation"] = args =>
(int)args.Evaluate(0) + (int)args.Evaluate(1);
var result = expression.Evaluate();
// 9
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.
Open an issue for bugs or usage problems. Include the expression, the expected result, the actual result, and your NCalc version.
| 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!
NCalc uses Nerdbank.GitVersioning. Each library build can be traced back to the original git commit. Read more in the release documentation.
<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 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on NCalcSync:
| Package | Downloads |
|---|---|
|
PanoramicData.NCalcExtensions
Extensions for NCalc |
|
|
PGCG.commonItems
Package Description |
|
|
NINA.Sequencer
This assembly contains the advanced Sequencer components of N.I.N.A. and the plugin definitions. |
|
|
Asgard.Yggdrasil
阿斯加德框架集核心库 |
|
|
PikTools.NonModelElements.Shared
Набор инстументов, содержащих общую логику приложения "Создание немоделируемых элементов" |
Showing the top 12 popular GitHub repositories that depend on NCalcSync:
| Repository | Stars |
|---|---|
|
ErsatzTV/legacy
Open-source platform that transforms your personal media library into live, custom TV channels.
|
|
|
squiggythings/WaveTracker
A free and open source music-making software for Windows. Uses wavetable synthesis and sampling to generate sounds.
|
|
|
textadventures/quest
Create text adventure games
|
|
|
AscensionGameDev/Intersect-Engine
Intersect provides a complete game development suite for creating 2d mmorpgs with no programming experience required!
|
|
|
MrCMS/MrCMS
Mr CMS is an open source C# MVC CMS Framework
|
|
|
egvijayanand/dotnet-maui-samples
Sample apps for working with .NET MAUI
|
|
|
JJConsulting/JJMasterData
.NET CRUD generator library with Bootstrap support to create dynamic forms at runtime from a data dictionary.
|
|
|
isbeorn/nina
N.I.N.A. (Nighttime Imaging 'N' Astronomy) - Advanced astrophotography sequencing software for Windows, supporting full automation of imaging sessions.
|
|
|
naweed/MauiScientificCalculator
Scientific Calculator built using #dotnetmaui
|
|
|
pre-martin/StreamDeckSimHubPlugin
Keep your Stream Deck buttons in sync with SimHub (and your simulation)
|
|
|
densen2014/Blazor100
Blazor入门100天
|
|
|
Seddryck/NBi
NBi is a testing framework (add-on to NUnit) for Business Intelligence and Data Access. The main goal of this framework is to let users create tests with a declarative approach based on an Xml syntax. By the means of NBi, you don't need to develop C# or Java code to specify your tests! Either, you don't need Visual Studio or Eclipse to compile your test suite. Just create an Xml file and let the framework interpret it and play your tests. The framework is designed as an add-on of NUnit but with the possibility to port it easily to other testing frameworks.
|