Being able to create javascript code on the fly is pretty cool. That is by using
HtmlPage.Window.Eval('alert('Hello World')');
But is there a way to do the same thing, with a C# method? Lets say something like
void MethodEval('MessageBox.Show('Hello World')');
Is it even possible, without having to recompile your code?
You can do it right now. The ag DLR (Silverlight Dynamic Languages Runtime) can host javascript.
While Javascript cannot be hosted with the DLR outside the browser Ruby and Python can. Here’s an example of a C# snippet using the DLR and hosting a piece of Python of code to demonstrate.