Friday, 9 August 2013

Compiler As A Service Execution Context

Compiler As A Service Execution Context

Is there anything I can do to make this code work?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mono.CSharp;
namespace MonoREPLTester
{
public class Program
{
static void Main(string[] args)
{
var evaluator = new Evaluator(new CompilerContext(new
CompilerSettings(), new ConsoleReportPrinter()));
string mystring="hello";
object result = evaluator.Run("mystring.IndexOf('e');");
Console.WriteLine("Result: "+result);
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
I currently get a warning because the Mono context doesn't have know about
mystring.
"error CS0103: The name 'mystring' does not exist in the current context"

No comments:

Post a Comment