tags:

views:

106

answers:

1

I'm still getting my head around LINQ queries and the LINQ extension methods.

Say I have a base class BaseA and subclass SubB with a property IsAwesome. I have an ObservableCollection<BaseA>. Is there some neat way I can grab a collection of only SubB classes where IsAwesome is true?

+1  A: 

You can do:

myCollection.Where(x => x is SubB && (x as SubB).IsAwesome);
Terje