Question on traversing through a list

olsonpm

Well-known member
Joined
Aug 24, 2010
Messages
46
Programming Experience
Beginner
I was wondering if there was a simple way to traverse through a list, while only grabbing the specified class.

here's what I'm doing now

VB.NET:
for each element as clsElement in lstElements
    if(typeof element is clsElementChild1)
        'do something
    end if
next

what I'd like to do is something like
VB.NET:
for each element as clsElementChild1 in lstElements.Only(clsElementChild1)
    'do something
next

I was looking through the enumerator functions as well and didn't see anything. It just seems like functionality that vb.net would have. If it's not there, no big deal - I was just wondering.

thanks,
Phil
 
Back
Top