6
我在使用MAX lambda表达式的vb equivilant时遇到了问题。在foos.Max(函数(X)x.id)当我尝试智能感知属性ID VS不会表现出来。但是,当我运行该示例它的作品。我在做什么是错的,我只是幸运而已?vb lambda MAX函数
Sub Main()
Dim foos As New List(Of Foo)
Dim bob As New Foo() With {.id = 5, .name = "bob"}
foos.Add(bob)
foos.Max(Function(x) x.id)
End Sub
Public Class Foo
Public Property id() As Integer
Get
Return m_id
End Get
Set(ByVal value As Integer)
m_id = Value
End Set
End Property
Private m_id As Integer
Public Property name() As String
Get
Return m_name
End Get
Set(ByVal value As String)
m_name = Value
End Set
End Property
Private m_name As String
End Class