110,534
社区成员
发帖
与我相关
我的任务
分享
public static List<T> QueryGenericObject<T>(IEnumerable<T> source, bool condition)
{
var query = from stu in source
where condition
select stu;
return query.ToList();
}
DemoLinq.Linq.StudentData stdata = new DemoLinq.Linq.StudentData();
bool str = (stdata.Sid == 1) ? true : false;
List<DemoLinq.Linq.StudentData> query = LinqSqlHelper.QueryGenericObject<DemoLinq.Linq.StudentData>(stuContent.StudentData,str);
我想根据具体需要 来改变条件 ,把他弄成一个比较通用的方法,显然 我的写法是不行的