markpirvine
markpirvine

Reputation: 1592

Filter WhereSelectEnumerableIterator of Generic List using Linq

I have the following code 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

Upvotes: 0

Views: 2568

Answers (1)

rob waminal
rob waminal

Reputation: 18429

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.

Upvotes: 1

Related Questions