[Mono-list] Embedding mono/C# in a file format...
Jonathan Pryor
jonpryor at vt.edu
Sun Jan 4 22:05:23 EST 2009
On Sun, 2009-01-04 at 12:15 -0800, SniperSlap wrote:
> Jonathan Pryor wrote:
> > Google up:
> > - System.CodeDom
...
> I noticed after writing my initial message that Mono 2.2 is going to have
> the "C# Evaluation API (Mono.CSharp.Evaluator)".
> How does this compare to the ideas you mentioned?
System.CodeDom would allow using any language with a CodeDom provider,
which includes VB.NET, C#, IronPython, etc. It's usually not difficult
to write such a provider, and is required for ASP.NET support.
Mono.CSharp.Evaluator is specific to C#. So that's one major-ish
difference.
The other major difference is output: System.CodeDom will produce IL
which you would use normally (save to disk, load & execute, etc.).
Mono.CSharp.Evaluator will execute immediately and return whatever the
evaluated expression returns.
So you could design things to make them do similar things, but how
they're more or less completely different.
> If this is going to be in
> the mono namespace, I'd assume this is not something supported by any MS
> .NET runtimes...
Also true; it's specific to Mono's C# compiler, though nothing should
stop you from embedding Mono's C# compiler into your app for use (as
it's MIT/X11 licensed).
> Is there any way to pre-compile the IL code and include it in an XML file?
Base64-encode the binary and use Assembly.Load(byte[]).
Not sure why you'd want to do this, but it should work. :-)
- Jon
More information about the Mono-list
mailing list