title: How do i convert a dynamic dictionary values to list?
body: <p>I have the below code: </p>
  
  <pre><code>List&lt;Type&gt; p1 = new List&lt;Type&gt;();
  p1.Add(typeof(int));
  p1.Add(typeof(string));
  dynamic genericDic = typeof(Dictionary&lt;, &gt;);
  dynamic specificDic1 = genericDic.MakeGenericType(p1.ToArray());
  dynamic dic1 = Activator.CreateInstance(specificDic1);
  dic1.Add(1, "John");
  dic1.Add(2, "Smith");
  dynamic genericLst = typeof(List&lt;&gt;);
  dynamic specificLst = genericLst.MakeGenericType(typeof(string));
  dynamic list = Activator.CreateInstance(specificLst);
  list.AddRange(dic1.Values.ToList());
  </code></pre>
  
  <p>When i try to perform the <code>list.AddRange(dic1.Values.ToList());</code> i get the following exception</p>
  
  <blockquote>
    <p>Public member 'ToList' on type 'ValueCollection' not found.</p>
  </blockquote>
  
  <p>Stack trace: </p>
  
  <pre><code>   at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String&amp; MemberName, Boolean ReportErrors)
     at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
     at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
     at StyleResearch.DataManagement.DataStream.Business.MonthEndProcess.ConverToLegacyStructureInMemory(List`1 marketDataTypeIds, String tableName, Int32 placeHolderValue) in C:\Style Research\Work\SRDM\trunk\StyleResearch.DataManagement.DataStream.Business\MonthEndProcess.vb:line 1850
     at StyleResearch.DataManagement.DataStream.UI.DDLMonthEndProcess._Lambda$__6(LegacyStructureDetail legacy) in C:\Style Research\Work\SRDM\trunk\StyleResearch.DataManagement.DataStream.UI\DDLMonthEndProcess.vb:line 1198
     at System.Threading.Tasks.Parallel.&lt;&gt;c__DisplayClass2d`2.&lt;ForEachWorker&gt;b__23(Int32 i)
     at System.Threading.Tasks.Parallel.&lt;&gt;c__DisplayClassf`1.&lt;ForWorker&gt;b__c()
  </code></pre>
  
  <p>NOTE: I have converted by VB.NET sample to C# but the stack trace is from the VB.NET project</p>
  
  <p>When i do the below it works absolutely fine:</p>
  
  <pre><code>Dictionary&lt;int, string&gt; dic = new Dictionary&lt;int, string&gt;();
  dic.Add(1, "John");
  dic.Add(2, "Smith");
  List&lt;string&gt; lst = new List&lt;string&gt;();
  lst.AddRange(dic.Values.ToList());
  </code></pre>