C# Eval - Compile Method - The parameter names

CSharp · Console

/Program.cs

// C# Eval Expression
// Doc: https://eval-expression.net/eval-compile

// @nuget: Z.Expressions.Eval

/*
### The parameter names

Using parameter names allows you to directly use those names in the expression instead of using their position.

If you don't specify a delegate, there is currently no way to specify parameter names, so you will need to keep using their parameter position.

If you specify a delegate, you can specify parameter names allowed in the expression by passing them via an `IEnumerable` or `params`.

In the following example, you will find multiple uses of how using parameter names in your dynamic C# expression:

See more: https://eval-expression.net/eval-compile
*/

using System;
using System.Collections.Generic;
using Z.Expressions;
					
public class Program
{
	public static void Main()
	{
		var compiledList1 = Eval.Compile<Func<int, int, int, List<int>>>("new List<int>() { A, B, C };", "A", "B", "C");

		var list1 = compiledList1(2, 4, 6);

		FiddleHelper.WriteTable(list1);
	}
}
;