[Mono-dev] Using Mono C# compiler for dynamic compilation of scripts
rafal.gwizdala at gmail.com
Fri Feb 14 11:58:56 UTC 2014
Sorry if this question shows my complete ignorance, but I'm stuck and don't
know where to go next.
I'm trying to use Mono C# compiler api for dynamic compilation of code
blocks. I was trying to use the Mono.CSharp.Evaluator class, but it's
rather suitable for evaling expressions or compiling simple code snippets
into methods, and I'd like to do few different things:
- compile whole class definition from a source file into an in-memory
- dynamically create a class by inheriting from an abstract base class and
implementing / overriding a single abstract method in it with script code
The second case is particularly interesting to me. What i'd like to to is
write the method body in the script file, and then convert it into a
derived class during compilation, so the script would not contain all the
boilerplate code (namespace references, class and method declarations) -
only the overridden method body. This is quite similar to what 'Rhino.DSL'
does in Boo - a script is converted into overridden method body in a
dynamically created class that inherits from some specified base type.
Can you point me to some examples?
Thanks a lot
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list