title: Is it possible to have a Func<bool> as a while condition
body: <p>Good evening,</p>
  
  <p>I was wondering if I could do something like:</p>
  
  <pre><code>while(true)
  {
     MyEnum currentValue = GetMyEnumValueFromDB();
     if(currentValue == MyEnum.BreakIfYouGetThis)
        break;
     else if(currentValue == MyEnum.AlsoBreakIfYouGetThis)
        break;
     else
        //Do some computing
  }
  </code></pre>
  
  <p>But instead of having a while(true) loop, I'd want to encapsulate the conditional logic in a Func and execute it like this:</p>
  
  <pre><code>while(new Func&lt;bool&gt;(/* what goes here? */))
  {
     //Do some computing
  }
  </code></pre>
  
  <p>In my case at least, it would look much cleaner, but i'm not sure how to do it (kinda new at Func/Action..).</p>
  
  <p><strong>EDIT</strong> hope this clarifies:<br>
  It could also be done like this:</p>
  
  <pre><code>while(GetMyEnumValueFromDB() != MyEnum.BreakIfYouGetThis &amp;&amp; 
        GetMyEnumValueFromDB() != MyEnum.AlsoBreakIfYouGetThis)
  {
     //Do some computing
  }
  </code></pre>
  
  <p>But that's 2 call to the database...</p>
  
  <p>Thanks =)</p>