使用下面的示例对象...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class Worker
{
public int WorkerId { get; set; }
}
}
如何获取 List<Worker>
中的最高/最后一个值的 WorkerId
属性(property)?
最佳答案
使用 LINQ:
var max = list.Max(x=>x.WorkerId);
关于c# - 如何从 POCO 对象集合中检索属性的最高/最后值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17052542/