我得到的是這樣的:
Private Sub GiantLegacySub()
... lots of variables and legacy code...
Dim somethingNew = New Func(of String, Boolean)(
Function(stringy as String) As Boolean
... new code that uses the legacy variables ...
End Function)
Dim t = New Thread(AddressOf somethingNew)
End Sub
我收到一個錯誤,表明它somethingNew被視為變數名而不是方法名,因此AddressOf. (我知道這somethingNew是一個變數,只是一個恰好包含指向方法的指標的變數)。
有沒有辦法做到這一點?GiantLegacySub由于其范圍內變數的剪切量,我需要將其留在內部。
uj5u.com熱心網友回復:
根據克雷格的指導,這是答案:
Private Sub GiantLegacySub()
... lots of variables and legacy code...
Dim somethingNew = Sub(stringy as String)
... new code that uses the legacy variables ...
End Sub
Dim t = New Thread(somethingNew)
t.Start(someStringForStringy)
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/388573.html
上一篇:線性化嵌套的for回圈
