简体   繁体   English

在C#中嵌入Boo的评估结果

[英]Eval result with embedding Boo in C#

I try to embed Boo language in a C# project. 我尝试将Boo语言嵌入C#项目中。 The simple code is as follows: 简单的代码如下:

var interpreter = new InteractiveInterpreter();

interpreter.Declare("Message", typeof(string));
interpreter.SetValue("Message", "A");
interpreter.Eval(@"
    print Message
    Message = 'B'
    print Message
");

Console.WriteLine(interpreter.GetValue("Message"));

The two 'print' commands does not output anything, and the 'Console.WriteLine' cluase output 'A'. 这两个'print'命令不输出任何内容,而'Console.WriteLine'群集输出为'A'。 What's the problem here? 这是什么问题

The problem is with the indentation of the evaluated code. 问题在于所评估代码的缩进。 Remove the indentation and it should work as expected. 删除缩进,它应该按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM