title: Using LINQ to create a List<T> where T : someClass<U>
body: <p>This is related to a prior question of mine <a href="https://stackoverflow.com/questions/8169091/c-sharp-generic-list-conversion-to-class-implementing-listt">C# Generic List conversion to Class implementing List&lt;T&gt;</a></p>
  
  <p>I have the following code:</p>
  
  <pre><code>public abstract class DataField
  {
      public string Name { get; set; }
  }
  
  public class DataField&lt;T&gt; : DataField
  {
      public T Value { get; set; }
  }
  
  public static List&lt;DataField&gt; ConvertXML(XMLDocument data) {  
       result = (from d in XDocument.Parse(data.OuterXML).Root.Decendendants()
                        select new DataField&lt;string&gt;
                        {
                            Name = d.Name.ToString(),
                            Value = d.Value
                        }).Cast&lt;DataField&gt;().ToList();  
      return result;
  }
  </code></pre>
  
  <p>This works however I would like to be able to modify the select portion of the LINQ query to be something like this:</p>
  
  <pre><code>select new DataField&lt;[type defined in attribute of XML Element]&gt;
  {
    Name = d.Name.ToString(),
    Value = d.Value
  }
  </code></pre>
  
  <p>Is this just a poor approach? is it possible?  Any suggestions?</p>