title: Initialize List<T> with array in CLR C++?
body: <p>I was wondering why this code does not work in C++/CLI but damn easy in C#?</p>
  
  <pre><code>List&lt;Process^&gt;^ processList = gcnew List&lt;Process^&gt;(
    Process::GetProcessesByName(this-&gt;processName)););
  </code></pre>
  
  <blockquote>
    <p>error C2664: 'System::Collections::Generic::List::List(System::Collections::Generic::IEnumerable ^)' : cannot convert parameter 1 from 'cli::array ^' to 'System::Collections::Generic::IEnumerable ^'</p>
  </blockquote>
  
  <p>Here is what I come up with. Did perfectly well. :)</p>
  
  <pre><code>List&lt;Process^&gt;^ processList = gcnew List&lt;Process^&gt;(
    safe_cast&lt;System::Collections::Generic::IEnumerable&lt;Process^&gt;^&gt;
      (Process::GetProcessesByName(this-&gt;processName)));
  </code></pre>