concept where method in category .net

appears as: Where method, Where methods
C# in Depth

This is an excerpt from Manning's book C# in Depth.

Listing 10.8. Using the Where method with a lambda expression to find odd numbers
var collection = Enumerable.Range(0, 10) .Where(x => x % 2 != 0) .Reverse(); foreach (var element in collection) { Console.WriteLine(element); }

10.3.3. Interlude: haven’t we seen the Where method before?

If the Where method feels familiar, it’s because you implemented it in chapter 6. All you need to do is convert listing 6.9 into an extension method and change the delegate type from Predicate<T> to Func<T,bool> and you have a perfectly good alternative implementation to Enumerable.Where: