title: C#: Check if type T is bool
body: <p>I can't believe I can't google this. I don't know what to google.</p>
  
  <pre><code>public static T GetValue&lt;T&gt;(T defaultValue)
  {
    if (T is bool) // &lt;-- what is the correct syntax here?
      return (T)true; // &lt;-- I don't think this works either
  }
  </code></pre>
  
  <p>EDIT: Sorry I didn't mention, the function above is only to show my question. It's not a real function. Thanks everyone for the answers!</p>