title: Using switch-case with string in Linq where clause
body: <p>I try to use <code>where</code> clause in my LINQ queries. When I use numerical value, it's fine but when I want to compare <code>string</code> value, it gives an error in <code>where</code> clause.</p>
  
  <pre><code>string StartBarcode = (from s in datamodel.Packages
                                      where s.RealBarcode == SelectedBarcode
                                      select s.StartBarcode).FirstOrDefault().ToString();
  
  IQueryable&lt;PageData&gt; q = (from v in datamodel.VW_WaypointDetails
                                            where (v.RealBarcode == null) ? StartBarcode : v.RealBarcode
                                            select new PageData
                                            {
                                                Name = v.Name,
                                                Surname = v.Surname,
                                                Description = v.Description
                                             }
  </code></pre>
  
  <p>Errors are that <em>'Cannot convert lambda expression to type 'string' because it is not a delegate type'</em> (I added <code>System.Linq</code>) and <em>Cannot implicitly convert type 'string' to 'bool'</em>.
  How can I use that <code>switch-case</code> statement with <code>string</code> value?
  Thanks for all answers.</p>