[Mono-devel-list] Interactive C# prompt
peter at newton.cx
Tue Jul 19 12:44:55 EDT 2005
If this is indeed what you want to do, you may want to look at
CSharpShell, which someone mentioned on this list a while back:
Not sure whether it's active at all but I think it's the same sort of
thing that you're talking about.
On Tue, 2005-07-19 at 16:39 +0100, Elliott Draper wrote:
> Colin JN Breame wrote:
> >I'm wondering whether there is such a thing as an interactive C# prompt for
> >mono. e.g. where commands can be entered and executed one-by-one.
> >If not, any ideas about how I would go about writting something like this?
> >Mono-devel-list mailing list
> >Mono-devel-list at lists.ximian.com
> Are you referring to a way to execute small C# code statements and have
> them executed as if they were within a simple program, on the fly?
> Because if so, then you can use the classes and methods within
> System.CodeDom, specifically within System.CodeDom.Compiler, to compile
> and execute code. So you can take a command such as
> "string.Compare("test","testing")" from a prompt, build it up into a
> simple class with an entry point, use an ICodeCompiler object (which one
> depends on which language) to compile the code, and then execute the
> assembly in memory, returning the result back to the prompt (without
> saving any of the code or binary assembly to file, truly on the fly).
> This leaves you with a basic eval prompt for running simple statements,
> in whatever .Net language you choose to support using different
> ICodeCompiler's. You could ofcourse get as complicated as you like in
> building up the program to execute, depending on how much information
> you want to let the user enter straight from the command line, from
> simple statements to full code blocks.
> I have actually started working on a DotNet/Mono written shell named
> xSh, for both Windows and Linux, and one of the plugins I'm going to
> incorporate will be a simple C# code evaluator for running simple
> functions and simple bits of code off the command line. I hope to have a
> beta release out fairly soonish.
> If this was what your after and you'd like more info, or a code sample,
> just let me know.
> Oh and if I'm way off base and this isn't what you wanted... then ignore
> my ramblings :-)
> -= El =-
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
Peter Williams / peter at newton.cx
More information about the Mono-devel-list