1
爲了我有以下幾點:LINQ的GROUP BY和由多個條件
myFilteredContractors = (From c In myFilteredContractors
Join cc In myConClasses On c.ContractorId Equals cc.ContractorId
Where inClassifications.Contains(cc.ClassificationId)
Group c By Key = cc.ContractorId Into Group, Count = Count()
Order By Count Descending
Select (From c1 In myContractors Where c1.ContractorId = Key).FirstOrDefault).ToList
這是正確的,他們有分類的數量訂購承包商名單。
我還想通過是否有字段集(CompanyOverview
)來訂購它們,如果它是空字符串,則應該低於那些已設置其CompanyOverview
的承包商。此外,在訂購CompanyOverview
後,我想按註冊日期訂購。
所以應該排序:
- 分類
- 無論概述已設置的號碼(
c.CompanyOverview
) - 註冊日期(
c.AppliedDate
)
是否有可能所有的這在LINQ?通過X,以便由Y次,......
如果你看中的拉姆達檢查OrderBy()
和ThenBy()
功能:
[如何使用VB.Net lambda表達式按多列排序](http://stackoverflow.com/questions/1743661/how-to-order-by-multiple-columns-using-vb-net -lambda表達式) –