我有一个名为 table1 的数据表,其中有一个名为 column1 的整数列。
如何在 vb net 中使用 lambda 表达式获取列的最大值?
谢谢!
最佳答案
Dim max As Int32 = table1.AsEnumerable().
Max(Function(r) r.Field(Of Int32)("column1"))
或者在查询语法中,often more readable in VB.NET 是什么? :
Dim values = From row In table1.AsEnumerable()
Select row.Field(Of Int32)("column1")
Dim maxValue As Int32 = values.Max()
关于vb.net - lambda表达式vb.net用于数据表中的最大值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22563411/