gpt4 book ai didi

c# - 如何将 System.Linq 命名空间导入 Boo?

转载 作者:太空狗 更新时间:2023-10-30 00:45:54 31 4
gpt4 key购买 nike

当我尝试将 System.Linq 命名空间导入 Boo 编译器时,出现此错误:

Boo.Lang.Compiler.CompilerError:

Namespace 'System.Linq' not found, maybe you forgot to add an assembly reference?

我使用“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());
}
}

最佳答案

为什么您的 DSL 中需要 System.Linq? Sytem.Linq 必须“隐藏”在您的框架中。除了在 Boo 中使用 Linq 之外,它有点冗长(在我看来)并且您的 DSL 应该隐藏这些冗长的东西......

import System.Linq.Enumerable from System.Core
bar = List of string()
bar.Add("foo")
bar.Add("baz")

baz = bar.Where({x as string | x =="baz"}).Single()

关于使用System.Linq,没试过但我找到了这个链接Boo Markmail ,上面的代码被复制了...

关于c# - 如何将 System.Linq 命名空间导入 Boo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4583076/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com