使用下面的示例对象...
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);
