DollarSignEngine 1.0.3
dotnet add package DollarSignEngine --version 1.0.3
NuGet\Install-Package DollarSignEngine -Version 1.0.3
<PackageReference Include="DollarSignEngine" Version="1.0.3" />
paket add DollarSignEngine --version 1.0.3
#r "nuget: DollarSignEngine, 1.0.3"
// Install DollarSignEngine as a Cake Addin #addin nuget:?package=DollarSignEngine&version=1.0.3 // Install DollarSignEngine as a Cake Tool #tool nuget:?package=DollarSignEngine&version=1.0.3
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 | Versions 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. |
.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. |
-
.NETStandard 2.1
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net5.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net6.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net7.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
-
net8.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.9.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.