Got a WPF Form with a StackPanel containing Expanders with StackPanels in it.
You can use OfType<> to filter for just a specific type in a list. I understand that you want to loop through all the StackPanels (in the list), so you can do something like this:
foreach(var panel in tmpList.OfType()){
//your work here ...
}
If you want to check if there is any StackPanel, then use this:
if(tmpList.OfType().Any()){
//...
}