我有这个对象:
public class BtnCountViews
{
public BtnCountViews()
{
}
public int DayOfYear { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public int BtnCount { get; set; }
public int Views { get; set; }
}
我希望做的是从一组对象中获取Month = 5的Views平均值。
以下是获取列表数据的代码:
public static List<BtnCountViews> btnCountViewsList = db2.Query<BtnCountViews>(sql);
btnCountViewsList.Where(b => b.Month == 5).Average(b => b.Views);
- JohnyL