尝试将Count用作lambda时,我遇到了一个奇怪的错误
‘Public ReadOnly Property Count As Integer’ Has no parameters and its
return type cannot be indexed’
如果我算上LongCount,它就会神奇地起作用.根据this blog post 3年前,这是一个众所周知的问题.它似乎仍然存在.我的问题是如何解决这个问题?
Module Module1 Sub Main() Dim wit2 As New List(Of TestCount) From {New TestCount With {.title = "foo" _,.PartNumber = "bar"} _,New TestCount With {.title = "chuck" _,.PartNumber = "norris"}} Console.WriteLine(wit2.Count(Function(x) x.title = "chuck")) End Sub Friend Class TestCount Property title As String Property PartNumber As String End Class End Module