Lambda VB.Net expression without intellisense

Using lambda in VB.Net results in no intellisense. Is this a bug with VS2010 or is it expected? Please note that it works fine in C #

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

UPDATE: Here is an example.

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
+3
source share
1 answer

An object array will not be strongly typed as a List (Of T) class. Therefore, when you enter "x". and expect the "Number" to appear in Intellisese, this will not happen. Runtime has no idea about the types of objects inside this array.

If you decide to do this, you can use LINQ to transform this array into a massive collection of objects, which Intellisense will then show you. The following line should work correctly:

Dim ChequeList = ( c MyArrayOfObjects c).ToList()

, VB.NET vs # intellisense. " Infer" 'On'. , ( 05 → 08 → 10)

- System.MissingMemberException?
http://allen-conway-dotnet.blogspot.com/2010/09/why-are-my-lambda-functions-throwing.html

+1

All Articles