title: C# Razor Linq, one generic variable giving unexpected results
body: <p>Can you please explain this what I am doing wrong here</p>
  
  <p>I am using a search criteria in linq and having this problem while filtering the results that if I used the one generic variable then it doesn't search as expected.</p>
  
  <p>I used separate variable and it worked</p>
  
  <p>Works fine:</p>
  
  <pre><code>string city = Request.QueryString["city"];
  properties = (Request.QueryString["city"] != null) ? properties.Where(x =&gt; x.City == city) : properties;
  
  string pType = Request.QueryString["propertytype"];
  properties = (Request.QueryString["propertytype"] != null) ? properties.Where(x =&gt; x.PropertyType == pType) : properties;
  </code></pre>
  
  <p>Doesn't work when I use the one generic variable:</p>
  
  <pre><code>string searchCriteria = Request.QueryString["city"];
  properties = (Request.QueryString["city"] != null) ? properties.Where(x =&gt; x.City == searchCriteria) : properties;
  
  searchCriteria= Request.QueryString["propertytype"];
  properties = (Request.QueryString["propertytype"] != null) ? properties.Where(x =&gt; x.PropertyType == searchCriteria) : properties;
  </code></pre>
  
  <p>Also any strategy to make the multiple search more optimized.</p>