How do I do a nullable type constriant?
<p>Let say I have the following desire, to simplify the IConvertible's to allow me to call them by using a generic type parameter. I plan to do this by creating generic Converter and storing them on a static property of a static generic class. Here is the code to generate the delegates::</p>

<pre><code>static class IConvertibleHelper&lt;T&gt; where T : struct, IConvertible
{
    public static readonly Converter&lt;IConvertible, T&gt; Converter;
    public static readonly Converter&lt;IConvertible, T?&gt; NullableConverter;
    static IConvertibleHelper()
    {
        Type type = typeof(T).IsEnum ? Enum.GetUnderlyingType(typeof(T)) : typeof(T);
        Converter = Delegate.CreateDelegate(typeof(Converter&lt;IConvertible, T&gt;), typeof(Convert).GetMethod("To" + type.Name,new Type[]{typeof(object)})) as Converter&lt;IConvertible, T&gt;;
        NullableConverter = obj =&gt; obj == null ? default(T?) : (T?)Converter(obj);
    }
}
</code></pre>

<p>As an aside, there was a small side effect of adding supports for Enum's as they inherit from an IConvertible and apparently the conversion from UnderylingType to Enum is implicit and thus only required by the return type of the delegate. </p>

<p>Now, that the hard part is done, I want to add my extension methods:</p>

<pre><code> public static class IConvertibleHelper
 {
   public static T To&lt;T&gt;(this IConvertible convertible) where T:struct,IConvertible
   {
    return IConvertibleHelper&lt;T&gt;.Converter(convertible);
   }
   public static T? To&lt;T?&gt;(this IConvertible convertible) where T : struct, IConvertible
   {
      return IConvertibleHelper&lt;T&gt;.NullableConverter(convertible);
   }
 }
</code></pre>

<p>The first extension method is fine, and even works! 
The second extension does not compile at all. I can use the following rather lame work around:</p>

<pre><code> public static T? ToNullable&lt;T&gt;(this IConvertible convertible) where T : struct, IConvertible
 {
  return IConvertibleHelper&lt;T&gt;.NullableConverter(convertible);
 }
</code></pre>

<p>But then we're stuck with requiring to call a different signature to convert to nullable value types. 
An even poorer workaround (for usability reasons,imo), is to use an out or a ref parameter for the return, and right two methods. This technically allows for type inference magic to occur, but makes calling this simple little extension method more annoying.</p>
