Not really Ruby, which below is what I am for IronPython (make sure the assemblies are listed first):
runtime = IronPython.Hosting.Python.CreateRuntime(); } public void Run(string script, params object[] variables) { var scriptSource = runtime.GetEngineByFileExtension("py").CreateScriptSourceFromString(script, SourceCodeKind.Statements); var scope = runtime.GetEngineByFileExtension("py").CreateScope(); foreach (var variable in variables) foreach (var property in variable.GetType().GetProperties()) if (property.CanRead) scope.SetVariable(property.Name, property.GetValue(variable, null)); scriptSource.Execute(scope);
Here, the most important element is the script engine. You can request it with various options (extension in my case) and create scripts from memory or from disk sources.
You can also exchange variables that are also shown.
I think there is now a better way in C # 4.0, since C # itself has become a dynamic programming language.
source share