Cel.NET 2.3.1

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

Cel.NET - Common Expression Language for .NET

Build Status NuGet Package

This is a C# port of the Common Expression Language (CEL), based on CEL-Java.

The CEL specification can be found here.

Getting started

A very simple start:

using Cel.Checker;
using Cel.Tools;

public class MyClass
{
    public void MyScriptUsage()
    {
        // Build the script factory
        ScriptHost scriptHost = ScriptHost.NewBuilder().Build();

        // create the script, will be parsed and checked
        Script script = scriptHost.BuildScript("x + ' ' + y")
            .WithDeclarations(
                // Variable declarations - we need `x` and `y` in this example
                Decls.NewVar("x", Decls.String),
                Decls.NewVar("y", Decls.String))
            .Build();

        IDictionary<string, object> arguments = new Dictionary<string, object>();
        arguments.Add("x", "hello");
        arguments.Add("y", "world");

        string result = script.Execute<string>(arguments);

        Console.WriteLine(result); // Prints "hello world"
    }
}

Protobuf and Json.NET and plain C# objects

Protobuf (via Google.Protobuf) objects and schema is supported out of the box.

It is also possible to use plain C# and Json.NET objects as arguments by using the Cel.Common.Types.Json.JsonRegistry.

Code sample similar to the one above. It takes a user-provided object type MyInput.

using Cel.Checker;
using Cel.Tools;

public class MyClass
{
    public bool EvalWithJsonObject(MyInput input, string checkName)
    {
        // Build the script factory
        ScriptHost scriptHost = ScriptHost.NewBuilder()
            .Registry(JsonRegistry.NewRegistry())
            .Build();

        // Create the script, will be parsed and checked.
        // It checks whether the property `Name` in the "Json-ized" class `MyInput` is
        // equal to the value of `checkName`.
        Script script = scriptHost.BuildScript("inp.Name == checkName")
            // Variable declarations - we need `inp` +  `checkName` in this example
            .WithDeclarations(
                Decls.NewVar("inp", Decls.NewObjectType(typeof(MyInput).FullName)),
                Decls.NewVar("checkName", Decls.String))
            // Register our Json-NET object input type
            .WithTypes(typeof(MyInput))
            .Build();

        IDictionary<string, object> arguments = new Dictionary<string, object>();
        arguments.Add("inp", input);
        arguments.Add("checkName", checkName);

        bool result = script.Execute<bool>(arguments);

        return result;
    }

}

Note that the Json.NET field-names are used as property names in Cel.NET. It is not necessary to annotate "plain C#" classes with Json.NET attributes.

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework 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 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 (1)

Showing the top 1 NuGet packages that depend on Cel.NET:

Package Downloads
Confluent.SchemaRegistry.Rules

Provides schema rules support.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Cel.NET:

Repository Stars
confluentinc/confluent-kafka-dotnet
Confluent's Apache Kafka .NET client
Version Downloads Last Updated
2.3.1 10,118 9/10/2026
2.3.0 380 9/7/2026
2.2.1 520 8/28/2026
2.2.0 555 8/24/2026
2.1.3 129 8/23/2026
2.1.2 147 8/23/2026
2.1.1 151 8/23/2026
2.1.0 417 8/19/2026
2.0.0 763 8/15/2026
1.2.0 296 8/14/2026
1.1.0 12,201 7/2/2026
1.0.0 48,477 11/27/2025
0.4.0 12,301 8/14/2025
0.3.2 33,077 9/10/2024
0.3.1 4,654 7/9/2024
0.3.0 1,943 11/14/2022
0.2.0 705 9/14/2022
0.1.0 707 9/14/2022