NCalcSync 6.1.0

dotnet add package NCalcSync --version 6.1.0
                    
NuGet\Install-Package NCalcSync -Version 6.1.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="NCalcSync" Version="6.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NCalcSync" Version="6.1.0" />
                    
Directory.Packages.props
<PackageReference Include="NCalcSync" />
                    
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 NCalcSync --version 6.1.0
                    
#r "nuget: NCalcSync, 6.1.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 NCalcSync@6.1.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=NCalcSync&version=6.1.0
                    
Install as a Cake Addin
#tool nuget:?package=NCalcSync&version=6.1.0
                    
Install as a Cake Tool

NCalc

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.

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

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (18)

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

Набор инстументов, содержащих общую логику приложения "Создание немоделируемых элементов"

GitHub repositories (12)

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.
Version Downloads Last Updated
6.1.0 198 6/7/2026
6.0.0 354 6/6/2026 6.0.0 is deprecated.
5.13.0 1,418 6/4/2026
5.12.0 245,135 2/19/2026
5.11.0 157,834 12/19/2025
5.10.0 25,438 12/18/2025
5.9.0 69,909 12/2/2025
5.8.0 156,064 11/4/2025
5.7.0 138,448 9/22/2025
5.6.0 166,415 8/3/2025
5.5.0 67,618 7/9/2025
5.5.0-alpha 9,433 2/14/2025
5.4.2 170,727 4/29/2025
5.4.1 163,816 2/14/2025
5.4.0 24,998 2/14/2025
5.3.1 117,678 12/18/2024
5.3.0 98,057 11/16/2024
5.2.11 325,845 10/25/2024
5.2.10 103,273 10/7/2024
5.2.9 51,429 9/26/2024
Loading failed