title: If statement in LINQ where clause C#
body: <p>I have written a query, and was wondering how I could implement an if statement in the where clause so that the "category_id" filter can only be added if the value is set. If the "category_id" value is null, then it would not complete the statement. Basically I am trying to make this statement into a toggle when inputting through SQL</p>
  
  <pre><code>var r = from lh in db.lh_url
          where lh.category_id == clientInfo.cf.category_id
          where lh.first_id &gt;= id
          where lh.first_id &lt; (id + BatchSize)
          orderby ph.url, ph.vendor, ph.product
          select new
          {
              lh
          };
  </code></pre>