0

I need my superusers to write some basic expressions like (getting today, or getting first day of last month, or just returning a default int value like 40), that I can later execute and get the result. It will be used for basic scripting that will provide an optional default value for a report parameter. It would be nice if it did not require any additional installation

So does c-sharp support any scripting languages that it can happily execute and evaluate?

thanks in advance,

It's an ASP.Net application and .Net Framework 4.5

hazimdikenli
  • 5,709
  • 8
  • 37
  • 67
  • What type of scripts? Try to look at IronPython, IronRuby or other Iron* scripting languages, which use DLR. – Ilya Ivanov Nov 06 '13 at 14:57
  • 1
    Have you looked at scriptcs? http://scriptcs.net/ – devshorts Nov 06 '13 at 14:58
  • @IlyaIvanov Basic scripts that will provide an optional default value for a report parameter. It would be nice if it did not require any additional installation. – hazimdikenli Nov 06 '13 at 14:58
  • Maybe something like [csscript](http://www.csscript.net/)? `CSScript.Evaluator.Evaluate("DateTime.Today")` – Brad Christie Nov 06 '13 at 14:59
  • Are you looking for a particular feature? A Google search for "c# scripting" gives back a lot of results. I've used Razor templates successfully for reports in the past. – madd0 Nov 06 '13 at 15:02

4 Answers4

1

LUA is a scripting language that is able to be used from C#, take a look at LuaInterface

Anonymous
  • 11
  • 1
1

You can use NLua (http://nlua.org/ https://www.nuget.org/packages/NLua/)

Super easy to integrate, and work on any platform.

Vinicius Jarina
  • 797
  • 5
  • 16
0

I recently used IronPython to provide "scripting" to a program. You can embed the IronPython runtime in your program and let it execute scripts passed as a string. Look here for some examples.

You can also execute C# code compiled on the fly. See here.

Community
  • 1
  • 1
Carles Company
  • 7,118
  • 5
  • 49
  • 75
0

Short answer, yes. There are a lot of different possible script engines for pretty much any possible scripting language.

Personally, i like to use C# for scripts too. Then make the program load the script file and compile it runtime.

Jite
  • 5,761
  • 2
  • 23
  • 37