Linq and Lamba Expressions - while walking a selected list perform an action
- by Prescott
Hey, I'm very new to linq and lamba expressions. I'm trying to walk a collection, and when I find an item that meets some criteria I'd like to add that to another separate collection.
My linq to walk the collection looks like this (this works fine):
From i as MyCustomItem In MyCustomItemCollection Where i.Type = "SomeType" Select i
I need each of the select items to then be added to a ListItemCollection, I know I can assign that linq query to a variable, and then do a for each loop adding a new ListItem to the collection, but I'm trying o find a way to add each item to the new ListItemcollection while walking, not a second loop.
Thanks
~P