//Limit records, order remaining records, then take first or default.
x.Where(predicateExpression)
.OrderBy(rankExpression)
.FirstOrDefault();
//Order records, take first of ordered set that matc
領域是否有LINQ爲乘兩個字段的任何選項 public class details
{
public int qty { get; set; }
public decimal unitprice{ get; set; }
public decimal total{ get; set; }
}
select new details
{
qty =x.qty ,
unitprice
試圖編寫一段動態的代碼,它可以接受任意數量的可能的模型定義。 當前硬盤的代碼是: var items = _context.Events.ToList();
foreach (var item in items)
{
(...)
}
我想這樣做是爲了使_context.Events.ToList();更像_context.{variable that holds model
我有一個像下面兩個表:(日期格式:MM/DD/YYYY) 參數主表: Id Parameter
1 ST
2 GP
3 Interest
4 CC
和第二TaxValue表: Date ParameterId Value
1/1/2017 1 4
2/1/2017 1 4.5
1/15/2017 2 15
3/20/201