1
我已經寫了一些代碼的方法時,在那裏我執行我的方法的參數的動作寫在參數子:Vb.Net調用
_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
現在我想延長傳遞給我的服務方法分有:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) _eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
這顯然好好嘗試一下WOR ķ。這可能嗎?
在VB中的縮進和換行字,使代碼更可讀(在Github上,因爲評論太短):https://gist.github.com/klmr/5003412 – 2013-02-21 09:14:51
@KonradRudolph thnx :) – JMan 2013-02-21 09:36:48