使用类型为boolean的动态ListItem列构造linq查询

时间:2011-09-05 14:07:42

标签: c# linq splistitem splist

“selectedBA”是包含@ runtime确定的值的变量。我如何将其合并到一个linq语句中,该语句将为我提供SPList中的所有项目,其中动态列selectedBA在项目中为True。可能是我想的一些简单...动态列是SPList中的Type Boolean

DataTable dt = siteTemplateList.GetItems().GetDataTable();
var query = from template in dt.AsEnumerable()
            where template[selectedBA].Equals(true)
            select template;

1 个答案:

答案 0 :(得分:0)

DataTable dt = siteTemplateList.GetItems().GetDataTable();
var query = from template in dt.Rows
            where template[selectedBA].Equals(true)
            select template;
相关问题