目前,这根本不可能.当前版本的VB不支持多行(或语句)lambda.每个lambda只能包含一个表达式.下一个版本的VB将修复它(在上一个版本中没有足够的时间).
在此期间,您将不得不与代表合作:
Private Shared Sub Foobar(x As IInitializationExpression) x.AddRegistry(New DataAccessRegistry) x.AddRegistry(New CoreRegistry) x.AddRegistry(New WebUIRegistry) x.Scan(AddressOf Barfoo) End Sub Private Shared Sub Barfoo(ByVal scanner As IAssemblyScanner) scanner.Assembly("RPMWare.Core") scanner.Assembly("RPMWare.Core.DataAccess") scanner.WithDefaultConventions End Sub ' … ' ObjectFactory.Initialize(AddressOf Foobar)