title: LINQ: adding where clause only when a value is not null
body: <p>I know a typical way is like this:</p>
  
  <pre><code>IQueryable query = from staff in dataContext.Staffs;
  if(name1 != null)
  {
       query = from staff in query where (staff.name == name1);
  }
  </code></pre>
  
  <p>However, from a program we took over from other developers, we saw code like this:</p>
  
  <pre><code>IQueryable query = from staff in dataContext.Staffs;
  query = from staff in query where (name1 == null || staff.name == name1);
  </code></pre>
  
  <p>If this is a normal SQL statement, I would definitely say that the 2nd one is a bad practice. Because it adds a meaningless where clause to the query when name1 is null.</p>
  
  <p>But I am new to LINQ, so I am not sure if LINQ is different? </p>