DollarSignEngine 1.0.2

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

DollarSignEngine

Dynamically evaluate and interpolate C# expressions at runtime with ease, leveraging a powerful script execution engine.

Introduction

The DollarSignEngine is a robust C# library designed to simplify the process of dynamically evaluating and interpolating expressions at runtime. Ideal for applications requiring on-the-fly script execution, it offers developers the flexibility to inject variables and execute complex C# expressions seamlessly.

Features

  • Dynamic Expression Evaluation: Evaluate C# expressions dynamically at runtime, with support for interpolation and complex logic.
  • Parameter Injection: Easily pass parameters into expressions for dynamic evaluation.
  • Support for Complex Types: Effortlessly handle complex data types, including custom objects, collections, and more.
  • Comprehensive Error Handling: Provides detailed exceptions for compilation and runtime errors to ease debugging.

Installation

The library is available on NuGet. You can install it using the following command:

dotnet add package DollarSignEngine

Usage

Below are some examples of how to use the DollarSignEngine to evaluate expressions dynamically.

Evaluating Simple Expressions

var result = await DollarSign.EvalAsync("1 + 1");
Console.WriteLine(result); // Outputs: 2

Interpolating Strings with Parameters

var parameters = new Dictionary<string, object>
{
    { "name", "John" }
};
var result = await DollarSign.EvalAsync("Hello, {name}", parameters);
Console.WriteLine(result); // Outputs: Hello, John

Handling Complex Data Types

var person = new { FirstName = "Jane", LastName = "Doe" };
var parameters = new Dictionary<string, object>
{
    { "person", person }
};
var result = await DollarSign.EvalAsync("Person: {person.FirstName} {person.LastName}", parameters);
Console.WriteLine(result); // Outputs: Person: Jane Doe

More usage can be found in the test code. Show Tests

Contributing

Contributions are welcome! If you have an idea for improvement or have found a bug, please feel free to create an issue or submit a pull request.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
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 DollarSignEngine:

Package Downloads
DocuChef

A flexible .NET library that transforms data into professionally formatted documents through intuitive template binding, serving Excel, Word, PowerPoint, and beyond.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.4 146 6/1/2025
1.3.3 145 5/29/2025
1.3.2 152 5/29/2025
1.3.1 77 5/24/2025
1.3.0 151 5/22/2025
1.2.0 242 5/15/2025
1.1.0 158 5/1/2025
1.0.3 154 6/4/2024
1.0.2 182 4/4/2024
1.0.1 132 4/4/2024