我正在尝试将 StructureMap 挂接到现有的 webforms 应用程序中。由于它是网络表单,我必须使用 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
我希望反射器能够帮助我,但它提供的代码与我的类似,也无法编译。
那么,翻译是什么?