title: Generics: constraints on nullable types
body: <p>The following doesn't compile</p>
  
  <pre><code>public static T Retrieve&lt;T&gt;(this NameValueCollection collection, String key) where T : Object
  {
  
      if (collection.AllKeys.Contains(key))
      {
          try
          {
              val = (T)Convert.ChangeType((object)collection[key], typeof(T));
          }
          catch { }
      }
  
      return val;            
  }
  </code></pre>
  
  <p>because the Constraint cannot be the object class.  So is there a way to contrain T for anything that can be set to a null?</p>