C#/.NET Little Wonders: Select() and Where() with Indexes

added by BlackRabbitCoder
5/18/2012 8:32:09 AM

4 Kicks, 386 Views

We’ve talked about the Select() and Where() LINQ extension methods before. The Select() method lets you project from the source type to a new type, and the Where() method lets you filter the list of items to the ones you are interested in. Most people know of these methods in their simplest form, where they simply take a projection and predicate respectively that operates on just an element. However, there are overloads for both of these methods that take a delegate that operates on both the element and the index of the element.


5/17/2012 7:24:47 PM
new post