C# Lists, Foreach, and Types
- by user406470
I was wondering if there is a version of foreach that checks only for a specific type and returns it.
For example consider this class tree:
org.clixel.ClxBasic - org.clixel.ClxObject - org.clixel.ClxSprite - WindowsGame1.test
Then consider this code
public List<ClxBasic> objects = new List<ClxBasic>();
foreach(GroupTester tester in objects)
{
tester.GroupTesterOnlyProperty = true;
}
tester.GroupTesterOnlyProperty is a property created in GroupTester. Is there some way to make something like this work, like an overload of foreach, or another snippet that might help me? I want to make it easy for a programmer to sort through the lists grabbing only what type they need.