Only iterating over the objects you want in a foreach loop(jeremyjarrell.com)
submitted by
jeremyjarrell(2685) 5 years, 3 months ago
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.
|category: C#
|Views: 8
tags:
foreach another
Everyones tags:
Your Tags: