title: C# 7.3 Enum constraint: Why can't I use the nullable enum?
body: <p>Now that we have enum constraint, why doesn't compiler allow me to write this code?</p>
  
  <pre><code>public static TResult? ToEnum&lt;TResult&gt;(this String value, TResult? defaultValue)
      where TResult : Enum
  {
      return String.IsNullOrEmpty(value) ? defaultValue : (TResult?)Enum.Parse(typeof(TResult), value);
  }
  </code></pre>
  
  <p>The compiler says:</p>
  
  <blockquote>
    <p>Error CS0453 The type 'TResult' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable'</p>
  </blockquote>