title: How to have variable in a Linq Where clause?
body: <p>This should be a simple think that I´m missing, but have tried everything to solve....
  Basically I´m exploring Linq and:</p>
  
  <p>This works:</p>
  
  <p><code>List&lt;Project&gt; proj = Repo.Projects.Where(p =&gt; p.ID &lt; 3  ).ToList();</code></p>
  
  <p>But this does not work:</p>
  
  <pre><code>int i =3;
  List&lt;Project&gt; proj = Repo.Projects.Where(p =&gt; p.ID &lt; i  ).ToList();
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>proj = Repo.Projects.Where(p =&gt; p.ID ==  1 ).FirstOrDefault();
  </code></pre>
  
  <p>But this does not work:</p>
  
  <pre><code>int i =1;
  proj = Repo.Projects.Where(p =&gt; p.ID ==  i ).FirstOrDefault();
  </code></pre>
  
  <p>Get the following message from dotnetfifddle:</p>
  
  <pre><code>Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, Project)' to access type 'Program+&lt;&gt;c__DisplayClass0' failed.
  </code></pre>
  
  <p>What I´m doing wrong???</p>