title: Is it possible to delay the "bool" test in a Dictionary<string, Func<bool, object>>
body: <p>I have a <code>Dictionary&lt;string, Func&lt;bool, object&gt;&gt;</code> I would like to conditionally loop through the dictionary and add the "object" only if <code>bool == true</code>.<br>
  But I'm not sure how to pass <code>pair.Value()</code> as a bool.</p>
  
  <pre><code>foreach (KeyValuePair&lt;string, Func&lt;bool, object&gt;&gt; pair in parameters)
  {   
      //error pair.Value(), Delegate Func has 1 parameter(s) but is invoked with 0 arguments.  
      //pair.Value(true) obviously works, but defeats the purpose
  
      if (pair.Value() != null)
              cmd.Parameters.AddWithValue(pair.Key, pair.Value());
      } 
  }
  </code></pre>
  
  <p>Should I use <code>Expression&lt;Func&lt;bool, object&gt;&gt;</code> and compile/evaluate the bool.    If so, how?</p>