在VB.Net中使用lambda的結果沒有智能感知。這是VS2010的錯誤還是預期?請注意,在C#VB.Net沒有智能感知的Lambda表達式
Return Array.TrueForAll(chequeColl, Function(x) x.Number <> "N") 'No intellisense Number does not appear
Return Array.TrueForAll(chequeColl, Function(x As MyClass) x.Number <> "N") 'Now casted intellisense appears
更新工作正常:這裏有一個例子
Public Class Cheque
Public Property Id As String
Public Property Status As Byte
Public Property Amount As String
Public Property Number As String
End Class
Public Class ChequeCollection
Private chequeColl() As Cheque
Public Sub DoStuff()
Array.TrueForAll(chequeColl, Function(x As Cheque) x.Number = 1) 'x has to be cast as cheque for intellisense to appear
End Sub
End Class
您通常會在VB.Net中使用lambdas獲得智能感知。你可以發佈'chequeColl'的聲明嗎? – MarkJ 2011-03-09 14:58:05
它是一個簡單的類對象數組 – Jon 2011-03-09 15:14:36
@Jon它們是什麼樣的'Objects'?如果他們不是MyClass,那麼這就是爲什麼你沒有獲得智能感知。 – msarchet 2011-03-09 15:24:11