如何使用WPF C#
中的Entity Framework从dataGrid字段列中获取最大值var MaxID = dataGridView1.Rows.Cast<DataGridViewRow>()
.Max(r => Convert.ToInt32(r.Cells["Id"].Value));
答案 0 :(得分:0)
var MaxID = (EqupmentdataGrid.Items.Cast< EntityName >()).Max(r => r.Id);
Ex:var MaxID =(EqupmentdataGrid.Items.Cast&lt;'Equipment&gt;())。Max(r =&gt; r.Id);
结果:10002