Mono.CSharp.Evaluator.ReferenceAssembly C# (CSharp) Method

ReferenceAssembly() public method

Exposes the API of the given assembly to the Evaluator
public ReferenceAssembly ( Assembly a ) : void
a System.Reflection.Assembly
return void
        public void ReferenceAssembly(Assembly a)
        {
            lock (evaluator_lock){
                importer.ImportAssembly (a, module.GlobalRootNamespace);
            }
        }

Usage Example

Example #1
0
        private static void InitializeEvaluator()
        {
            _Interop.VarStorage["ReplVersion"] = typeof(Program).Assembly.GetName().Version;

            var settings = new CompilerSettings() {
                StdLib = true
            };

            var reportPrinter = new ConsoleReportPrinter();

            var ctx = new CompilerContext(settings, reportPrinter);

            evaluator = new Evaluator(ctx);

            evaluator.ReferenceAssembly(typeof(_Interop).Assembly);

            evaluator.Run(
            @"
            using System;
            using System.Collections.Generic;
            using System.Linq;
            using System.Text;
            ");

            evaluator.Run("var _v = _Interop.VarStorage;");
            evaluator.Run("var _h = _Interop.History;");
            evaluator.Run("_Interop.VoidMethod exit = _Interop.Exit;");
            evaluator.Run("_Interop.ReturnStringListMethod globals = _Interop.GetGlobals");
        }
All Usage Examples Of Mono.CSharp.Evaluator::ReferenceAssembly