我编写了一些代码,我在我的方法参数中执行操作:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) _eventAggregator.SendMessage(message))
这是被调用的方法:
Public Sub MyMethod(userId As Guid, profileId As Guid, ByVal action As Action(Of EventArgs))
Dim proxy = BuildProxy()
AddHandler proxy.MyMethodCompleted, Sub(o, e) action(e)
Using New OperationContextScope(proxy.InnerChannel)
Dim request = New MyMethodRequest() With {.gebruikerId = userId, .omgevingsId = omgevingId}
proxy.MyMethodAsync(request)
End Using
End Sub
现在我想将传递给我的服务方法的Sub扩展为包括:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) _eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
这显然不起作用。这可能吗?
答案 0 :(得分:1)
发现它已经准备好了。从c#切换到vb.net并不总是那么容易;)
_myService.MyMethod(userId, profileId, Sub(message As EventArgs)
_eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
我必须在我的潜艇后点击下一行......