title: How to return a generic list?
body: <p>I don't even think I have the question correct as I am just starting with generics and my knowledge isn't very great.</p>
  
  <p>Say I have the following method:</p>
  
  <pre><code>public class Wrapper
  {
      public List&lt;TInfoType&gt; GetInfo&lt;TInfoType&gt;(Array data, EdmCmd edmCmd)
      {
          switch (edmCmd.meCmdType)
          {
          case EdmCmdType.EdmCmd_PostAdd:
              List&lt;EdmCmdPostAddInfo&gt; info = new List&lt;EdmCmdPostAddInfo&gt;();
              foreach (EdmCmdData item in data)
              {
                  info.Add(new EdmCmdPostAddInfo(item.mlObjectID1, item.mlObjectID2, item.mbsStrData1, item.mlLongData1));
              }
              return info;
              break;                
          default:
              break;
          }
      }
  }
  </code></pre>
  
  <p>And I would like to call the method like:</p>
  
  <pre><code>List&lt;EdmCmdPostAddInfo&gt; info = wrapper.GetInfo&lt;EdmCmdPostAddInfo&gt;(data, edmCmd)
  </code></pre>
  
  <p>What is the correct way to do this? I am getting the error:</p>
  
  <pre><code>Cannot implicitly convert type 'System.Collections.Generic.List&lt;EPDM.Utils.EdmCmdPostAddInfo&gt;' to 'System.Collections.Generic.List&lt;TInfoType&gt;'
  </code></pre>
  
  <p>I am doing this because the EdmCmd struct that is passed to the method has various members that are generically named. It's difficult to remember what the members represent for each CmdType, so I am wrapping them in a more meaningful struct.</p>