开发者

Filter WhereSelectEnumerableIterator of Generic List using Linq

I have the following c开发者_如何学编程ode which builds a Generic List of Abc from a database query.

List<Abc> lAbc = DB.GetAbc();

var lRawData = from r in lAbc
               group r by r.Stage1Check into s
               select s.ToList();

This gives me a WhereSelectEnumerableIterator of Generic List of Abc - which is ok. I then write this data to an Excel sheet.

The problem is that I need to further filter this data. The object Abc contains a property called FilterProp which is a boolean. What I can't figure out is how to use Linq to filter lRawData where the FilterProp is true?

Mark


you could do something like this

var lRawData = from r in lAbc
               group r by r.Stage1Check into s
               select s.Where(f=>f.FilterProp).ToList();

this filter lAbc after grouping.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜