Guest User

Guest User

  • Tech Writer
  • 357
  • 119.9k

Enumerable.Where method

Jun 15 2012 6:22 AM
Hi

Given the following code

List<string> fruits = new List<string>
{ "apple", "passionfruit", "banana", "mango", "orange", "blueberry", "grape", "strawberry"};

IEnumerable<string> query = fruits.Where(fruit => fruit.Length < 6);



Im having difficulty in matching this up to the actual Where method declaration as below:-


public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source,Func<TSource, bool> predicate

From what I can work out so far:-

IEnumerable<TSource> is IEnumerable<string> and the Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, is the (fruit => fruit.Length < 6); Linq & Lambda part?


Regards

Steven


Answers (6)