【发布时间】:2014-03-21 15:51:07
【问题描述】:
我有一个名为 table1 的数据表,其中有一列名为 column1 的整数。
如何在 vb net 中使用 lambda 表达式获取列的最大值?
谢谢!
【问题讨论】:
我有一个名为 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()
【讨论】: