Alder 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Alder --version 1.0.2
                    
NuGet\Install-Package Alder -Version 1.0.2
                    
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="Alder" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alder" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Alder" />
                    
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 Alder --version 1.0.2
                    
#r "nuget: Alder, 1.0.2"
                    
#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 Alder@1.0.2
                    
#: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=Alder&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Alder&version=1.0.2
                    
Install as a Cake Tool

Alder: C# Expression Engine for .NET

.NET CI .NET 8+ .NET Standard 2.0 NativeAOT No third-party dependencies MIT License

An embeddable C# expression evaluator with compiler-style binding for CLR types.

Alder is an embeddable C# expression engine for .NET applications. It evaluates expressions and statement blocks against your host's CLR types through a compiler-style semantic pipeline: parsing, binding, validation, interpretation, optional delegate compilation, Dynamic LINQ adaptation, expression-tree export, execution limits, and generated dispatch for NativeAOT. Lambdas, query syntax, pattern matching, async, and iterators bind with ECMA-334 semantics. Both execution backends share the same parser, binder, security policy, and execution limits, and both produce identical results.

Highlights

  • C# expressions and statements at runtime. Lambdas, queries, pattern matching, async, iterators, user-defined operators and conversions, evaluated with ECMA-334 7th edition semantics.
  • Native AOT through generated dispatch. A source generator emits reflection-free dispatch from [AlderRegistered] declarations. The interpreter runs under AOT without trim warnings.
  • Async inside expressions. EvaluateAsync awaits inside the bound tree. IAsyncEnumerable<T>, await foreach, and iterators are first-class through the interpreter.
  • One grammar, three surfaces. Expression evaluation, Dynamic LINQ (WhereDynamic, OrderByDynamic), and Expression<TDelegate> export for EF Core all parse through the same binder, validate against the same security policy, and answer to the same execution limits.

Targets net8.0 and netstandard2.0. Zero third-party runtime dependencies.

Install

dotnet add package Alder

A first look

AlderEval is the static entry point. Calls run against a default engine and need no setup:

using Alder;

AlderEval.Evaluate<int>("1 + 2");                                   // 3
AlderEval.Evaluate<decimal>("price * 1.2m", new { price = 100m });  // 120m

AlderEngine exposes the same evaluation surface as an instance you own and configure. The choice between the two is about lifecycle and configuration, not capability:

using var engine = new AlderEngine();

var tier = engine.Evaluate<string>("""
    var t = order switch
    {
        { Total: > 1000m, IsRush: true } => "premium-express",
        { Total: > 1000m }               => "premium",
        { IsRush: true }                 => "express",
        _                                => "standard"
    };
    return t;
    """, new { order });

End-to-end integration

A configured AlderEngine carries compiler, security policy, and generated AOT dispatch into every call it serves:

using Alder;
using Alder.Compiled;

using var engine = new AlderEngine(options =>
{
    options.UseCompiler();
    options.Security = SecurityOptions.Trusted();
    options.Aot.UseGeneratedContext(RulesAotContext.Default);
});

var accepted = engine.Evaluate<bool>(rule, new { order, minimum = 500m });

var quote = await engine.EvaluateAsync<decimal>(
    "await pricing.QuoteAsync(order)",
    new { order, pricing });

var report = await db.Orders
    .WhereDynamic(engine, """Status == "Open" && Total >= @0""", 250m)
    .OrderByDynamic<Order, decimal>(engine, "Total")
    .SelectDynamic<Order, OrderSummary>(engine, "new { Id, Total }")
    .ToListAsync();

Documentation

Full documentation, architecture notes, the language support matrix, security model, and Dynamic LINQ operator coverage live in the GitHub repository.

License

MIT

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 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. 
.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 was computed.  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

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.0.5 105 6/19/2026
1.0.4 103 6/19/2026
1.0.3 110 5/16/2026
1.0.2 132 5/10/2026
1.0.1 113 5/6/2026
1.0.0 104 5/6/2026

Breaking change: removed predefined Safe and Strict security policy presets. Alder now exposes Trusted as the only named preset and documents explicit SecurityOptions policies for host-owned security posture.