title: Am I understanding Predicates correctly in regards to LINQ
body: <p>I am trying to get my head around Predicates and LINQ.</p>
  
  <p>While the Syntax of LINQ is starting to make sense to me, I am having slightly more trouble with the theory behind LINQ.</p>
  
  <p>Here's what I have so far. When designing LINQ, instead of creating a new interface that defined each member that any object that it would be possible to query using LINQ would need to implement, Microsoft instead decided to take the existing class IEnumerable, and extend this class using extension methods.</p>
  
  <p>I think I understand extension methods. An extension method is a static method inside a static class. The first parameter passed into this method is passed in with the <code>this</code> parameter, and defines the type that is being extended. Then, any instance of this type within the same namespace as the extension method can make use of the method.</p>
  
  <p>So Microsoft created lots of Extension methods extending IEnumerable inside the System.LINQ namespace, and any class which uses the System.LINQ namespace and contains an object implementing IEnumerable can use these extension methods to query that object. Each of these extension methods takes a delegate as their second parameter.</p>
  
  <p>In regards to <code>where</code>, <code>where</code> is an extension method extending IEnumerable and returning a new Object which implements IEnumerable. The next parameter <code>where</code> takes is a predicate (a method returning a boolean) of type Func (a generic func). This is a delegate, which returns true or false and can take up to 16 parameters. However, instead of having to write a method which meets this criteria, create an instance of the Func type and point this towards your method, and pass this variable into the <code>where</code> method, C# allows you to write this on the fly. Everything you put after the word <code>where</code> when constructing your LINQ query becomes your predicate.</p>
  
  <p>Behind the scenes, the members of the object implementing IEnumerable are iterated through and evaluated against your predicate, and if <code>true</code>, are added to the new IEnumerable object using the <code>yield return</code> syntax.</p>
  
  <p>Apologies if this seems a bit disjointed but I have basically dumped everything out of my brain as I understand it and was hoping that somebody who understands this a lot better than myself would come along and tell me what bits I have correct, which bits are wrong and generally expand on what I have written above as I am having a bit of trouble properly understanding what is going on here.</p>