Reputation: 2629
I have written some code where i perform an action in my method's parameter:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) _eventAggregator.SendMessage(message))
This is the Method thats being called:
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
Now i want to extend the Sub passed to my service method to include:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) _eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
This obviously doens't work. Is this possible?
Upvotes: 1
Views: 182
Reputation: 2629
Found it allready. Switching from c# to vb.net isn't always easy ;)
_myService.MyMethod(userId, profileId, Sub(message As EventArgs)
_eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
Just had to hit next line after my sub ....
Upvotes: 1