我尝试你说的任何事情,但我无法完成我的工作 我的代码
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>();
答案 0 :(得分:0)
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;