title: Condition inside linQ Where condition
body: <p>I have the following object:</p>
  
  <pre><code>public class Result
  {
      public List&lt;Recomendation&gt; Recomendations { get; set; }
  }
  
  public class Recomendation
  {
      public List&lt;Segment&gt; Segments { get; set; }
  }
  
  public class Segment
  {
      public Leg OutBound { get; set; }  
      public Leg InBound { get; set; }   
  }
  
  public class Leg
  {
      public TimeSpan TotalTime { get; set; }
      public string Carrier { get; set; }
      public int RefNumber { get; set; }
  }
  </code></pre>
  
  <p>I have a List called <code>recommendations</code></p>
  
  <p>I need to do this:</p>
  
  <ul>
  <li>Filter <code>recommendations</code> by occurrence of a string  <code>arr</code> in  <code>Carrier</code>, inside either the outbound or the inbound objects. I tried doing this:</li>
  </ul>
  
  <p>Search Inbound alone:</p>
  
  <pre><code>var filteredList = recommendations.Where( r=&gt;r.Segments.Any(x =&gt; x.InBound.Carrier.Contains(arr))).ToList();
  </code></pre>
  
  <p>or search outbound alone:</p>
  
  <pre><code>var filteredList = recommendations.Where( r=&gt;r.Segments.Any(x =&gt; x.OutBound.Carrier.Contains(arr))).ToList();
  </code></pre>
  
  <p>I want to search for the occurrence of the string <code>arr</code> in <strong>BOTH</strong> inbound and outbound.</p>
  
  <p>The problem is sometimes InBound can be null or OutBound can be null. I want my linQ to work in either cases. </p>