日期:2014-05-20 浏览次数:20941 次
public void Test18() { Contract cont = new Contract(); List<Contract> listcont = cont.GetContractList(); decimal max = listcont.Max(e => e.ContractAmt); var items = from e in listcont where e.ContractAmt == max select e; foreach (var item in items) { Console.WriteLine("{0}:{1} 金额:{2} 时间:{3}", items.ContractNumber, items.CustomerNumber, items.ContractAmt, items.ContractDate); } }
public void Test18() { Contract cont = new Contract(); List<Contract> listcont = cont.GetContractList(); var maxItem = listcont.OrderByDescending(e => e.ContractAmt).FirstOrDefalut(); Console.WriteLine("{0}:{1} 金额:{2} 时间:{3}", maxItem.ContractNumber, maxItem.CustomerNumber, maxItem.ContractAmt, maxItem.ContractDate); }