如何将 System.Linq 命名空间导入到 Boo?
当我尝试将 System.Linq 命名空间导入 Boo 编译器时,出现以下错误:
Boo.Lang.Compiler.CompilerError:
未找到命名空间“System.Linq”,也许您忘记添加程序集引用?
我使用“Rhino.DSL.dll”,我的 DSL 引擎代码在这里:
public class MyDslEngine : DslEngine
{
protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
{
pipeline.Insert(1, new AnonymousBaseClassCompilerStep(typeof(DslBase), "Prepare",
"System.Linq",
"Azarakhsh.Framework.Repository" //it's my repository framework
));
pipeline.Insert(2, new UseSymbolsStep());
pipeline.Insert(3, new RunScriptCompilerStep());
}
}
When I try to import the System.Linq
namespace to Boo compiler, I get this error:
Boo.Lang.Compiler.CompilerError:
Namespace 'System.Linq' not found, maybe you forgot to add an assembly reference?
I use "Rhino.DSL.dll" and my DSL engine code is here:
public class MyDslEngine : DslEngine
{
protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
{
pipeline.Insert(1, new AnonymousBaseClassCompilerStep(typeof(DslBase), "Prepare",
"System.Linq",
"Azarakhsh.Framework.Repository" //it's my repository framework
));
pipeline.Insert(2, new UseSymbolsStep());
pipeline.Insert(3, new RunScriptCompilerStep());
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么 DSL 中需要 System.Linq? Sytem.Linq 必须“隐藏”在您的框架中。除了在 Boo 中使用 Linq 之外,它有点冗长(在我看来),你的 DSL 应该隐藏这些冗长的东西...
关于使用 System.Linq,还没有尝试过,但我发现了这个链接 Boo Markmail,上面的代码被复制到...
Why do you need System.Linq in your DSL? Sytem.Linq must be "hidden" in your framework. Besides using Linq in Boo, it's kinda of verbose (in my opinion) and your DSL should hide this verbose stuff...
About using the System.Linq, haven't tried but I found this link Boo Markmail, where the code above was copied...
尝试将对
System.Core
程序集的引用添加到您的项目中。System.Linq
命名空间中的大多数类都可以在该程序集中找到。如果这不起作用,您还可以尝试添加对 System.Data.Linq 的引用。
并且以后不要低估编译器提供的错误消息的用处。是的,有时它们很神秘,有时甚至具有误导性。但是,当您试图找出为什么某些东西无法编译您期望的工作时,它们无疑是一个很好的起点。
Try adding a reference to the
System.Core
assembly to your project. Most of the classes in theSystem.Linq
namespace are found in that assembly.If that doesn't work, you might also try adding a reference to
System.Data.Linq
.And in the future, don't underestimate the usefulness of the error messages provided by the compiler. Yes, sometimes they are cryptic and other times they are even misleading. But they're certainly a good place to start when you're trying to figure out why something won't compile that you expected to work.