【发布时间】:2010-12-08 17:27:02
【问题描述】:
我正在尝试将 StructureMap 连接到现有的网络表单应用程序。 由于是 web 表单,我必须使用 Setter Injection,这并不理想,但总比没有好。
我要解决的问题是翻译成 VB(我真的是一名 C# 开发人员,目前在一家 VB 商店工作)。我编写了一个自定义扫描仪,它在 C# 中运行良好,但我完全不知道如何将它翻译成 VB。
原来的 C# 是这样的:
public void Process(Type type, PluginGraph graph)
{
if (type.IsInterface)
{
graph.Configure(x => x.SetAllProperties(
y => y.TypeMatches(
z => z == type)));
}
}
我能在 VB 中得到的最接近的是:
Public Sub Process(ByVal type As Type, ByVal graph As PluginGraph) Implements ITypeScanner.Process
If type.IsInterface Then
graph.Configure(Function(x) _
x.SetAllProperties(Function(y) _
y.TypeMatches(Function(z) _
return z Is type _
) _
) _
)
End If
End Sub
我希望反射器能够帮助我,但它提供的代码与我的相似,也无法编译。
那么,翻译是什么?
【问题讨论】:
标签: vb.net structuremap ioc-container webforms