title: Lambda expression in 'if' statement condition
body: <p>I am new to C#, but from my understanding this code should work. Why doesn't it work?</p>
  
  <p>This is an example of my code.</p>
  
  <pre><code>List&lt;Car&gt; cars // This has many cars initialized in it already
  if (() =&gt; {
     foreach(Car car in cars){
         if (car.door == null) return true;
     }
  }){then .......}
  </code></pre>
  
  <p>Simply put, all I want the code to do is run the <code>if</code> statement if any car does not have a door.</p>
  
  <p>After trying to compile I get this error:</p>
  
  <blockquote>
    <p>Cannot convert lambda expression to type 'bool' because it is not a delegate type.</p>
  </blockquote>