I have a list which also contains a list which contains some objects:
var elements = new List<ElementGroup>()
{
new ElementGroup("WIRES")
{
new Element() {Name = "Wires", Image = "wires.jpg"}
},
new ElementGroup("GROUND")
{
new Element() {Name = "Ground", Image = "ground.jpg"}
}
};
ElementGroup class:
public class ElementGroup : List<Element>
I want to apply Linq query to all Element
objects from all ElementGroup
lists but if I do it like this:
elements.Where(c => c.Family.Contains(searchText.ToUpper()));
it applies the query on ElementGroup
lists.