title: The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method
body: <p>I followed the suggestion around this web site to made the following method:</p>
  
  <pre><code>public static T? GetElementValue&lt;T&gt;(this XElement xElement, string s) 
      where T : struct, IComparable
  {
       var result = new Nullable&lt;T&gt;();
  
       try
       {
           if (string.IsNullOrEmpty(s) || s.Trim().Length &gt; 0 || xElement.IsEmpty)
              return result;
  
           var element = xElement.Element(s);
  
           if (element == null || element.IsEmpty)
               return result;
  
           var conv = TypeDescriptor.GetConverter(typeof(T));
           result = (T)conv.ConvertFrom(element.Value);
       }
       catch (Exception ex)
       {
            ex.Message.WriteAsError();
       }
  
       return result;
  }
  </code></pre>
  
  <p>but when I try to use it with a <code>string</code> I still get the following error:
  The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method</p>
  
  <p>Someone can tell me why?
  Thx</p>