Linq 问题,
public List<Model.HumanModel> GetStar()
{
List<Model.HumanModel> temp = (from d in DataContext.hotSomething
join b in DataContext.T_userbase
on d.somethingid equals b.userid
join c in DataContext.users_sports
on b.userid equals c.userid into p
from c in p.Take(1)
where d.type == ApplicationSettings.userType && b.flag == false
select new Model.HumanModel(b.userid, b.uB_Name, b.uB_Sex == true ? "男" : "女", b.uCom_Address, c.uS_Sports, b.uB_Birthday == null ? 0 : Convert.ToInt32(DateTime.Now.Year - Convert.ToDateTime(b.uB_Birthday).Year), b.photopath, b.uB_Sign, b.photoUploadtime.HasValue ? b.photoUploadtime.Value : DateTime.Now, b.PermitFriendSee, b.permitMySelfSee)).Distinct().ToList();
return temp;
}
这个方法是好的,但是如果出现重复的数据的时候,我在后面加了一个Distinct(),重复数据没了,但是DataList的页面的排序出现了问题...求高手帮忙解答 谢谢