嗨我有diffuculties試圖得到一個計數。目前它顯示所有記錄但我想要一個計數。從linq查詢獲得計數
using (var ctx = DB.Get())
{
Items.AddRange(
ctx.Interactions.Where(x => x.ActivityDate >= StartDateTo &&
x.ActivityDate <= EndDateTo && x.Indepth == true).Select(
x => new InteractionDTO()
{
Indepth = x.Indepth
}
)
);
}
的'Count'方法? http://msdn.microsoft.com/en-us/library/bb535181(v=vs.110).aspx – asawyer
哪個字段需要計數? –
.Count()應該工作。將它應用到項目列表中,你應該很好去 – AAlferez