Error!
Success!

Only iterating over the objects you want in a foreach loop

0
kicks

Only iterating over the objects you want in a foreach loop  (Unpublished)

Have you ever had a collection made of several types which all derive from the same base class? How many times have you needed to iterate the whole collection and check each element to make sure its the type that you want to work with? Here's how to do you type checking completely inline inside of the foreach loop so you only get the objects you want.


Kicked By:
Drop Kicked By: