订购Linq加入
本文关键字:加入 Linq 订购 | 更新日期: 2023-09-27 18:13:03
我试了你说的任何方法,但我不能做我的工作这是我的代码
Func<Dead, Object> orderByFunc = null;
orderByFunc = Dead => Dead.Last_Name;
var query = from ded in searchDead
join ask in Asker on ded.Family_Number equals ask.Family_Number
orderby orderByFunc
select ask;
Functions.searchAsker = query.AsQueryable<Asker>();
string order = "Last Name";
var propertyorder = null
switch (order)
{
case "Last Name":
propertyorder = ded.Last_Name;
break;
case "First Name":
propertyorder = ded.First_Name
break;
default:
propertyorder = ded.Last_Name;
break;
}
var query = from ded in Dead
join ask in Asker on ded.Family_Number equals ask.Family_Number
orderby (propertyorder)
select ask;