Where () is an extension method that can be implemented as something like this:
IEnumerable<T> Where(self IEnumerable<T> sequence, Func<T, bool> predicate) { foreach(T current in sequence) if( predicate(current) ) yield return current; }
x => x == 1 is an anonymous procedure that returns true if x == 1 and false otherwise, something like this:
bool predicate(T value) { return value == 1; }
For more information on how the iterator block is compiled in Where (), there is a series explaining how they are compiled, starting here on Eric Lippert's blog.
source share