尝试将 Count 用作 lambda 时出现奇怪的错误
'Public ReadOnly Property Count As Integer' 没有参数并且它的返回类型不能被索引'
如果我数到LongCount,它会神奇地起作用。根据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