title: C++ Send a variable List of type ref class to a native class
body: <p>I basic have the following code.</p>
  
  <pre><code>//*** Field.h ***\\
  public ref class Field
  {
  public:
      String^ Name;
      UInt16 Lenght;
      Field(void);
  }
  
  //*** SNVT.h ***\\
  public ref class SNVT
  {
  public:
      String^ Name;
      UInt16 Index;
      List&lt;Field^&gt; FieldList;
      SNVT(void);
  }
  
  //*** Viewer.h ***\\
  public ref class Viewer
  {
  public:
      List&lt;SNVT^&gt; SNVT_List;
      Viewer(void);
      SomeViewerFunction();
  }
  
  //*** Viewer.cpp ***\\
  void SomeViewerFunction()
  {
  SNVT^ currentSNVT = gcnew SNVT();
  Field^ currentField = gcnew Field();
  currentField-&gt;Name = "Field Name";
  currentField-&gt;Leght = 10;
  
  currentSNVT-&gt;Name = "SNVT Name";
  currentSNVT-&gt;Index = 1;
  currentSNVT-&gt;FieldList.Add(currentField);
  
  SNVT_List.Add(currentSNVT);
  
  Tools New_Tools;
  New_Tools.SomeToolsFunction(SNVT_List);
  }
  
  //*** Tools.h ***\\
  class Tools
  {
  public:
      Tools(void);
      SomeToolsFunction(List&lt;SNVT^&gt; Tools_SNVT_List);
  }
  
  //*** Tools.cpp ***\\
  void SomeToolsFunction(List&lt;SNVT^&gt; Tools_SNVT_List)
  {
  /*
  use Tools_SNVT_List here
  */
  }
  </code></pre>
  
  <p>So the idea is that I would call SomeViewerFunction, which will add data to SNVT_List. Then SomeViewerFunction will create an instance of Tools, to call SomeToolsFunction. SomeToolsFunction takes the variable SNVT_List.</p>
  
  <p>But I get an error; class "System::Collections::Generic::List" has no suitable copy constructor.</p>
  
  <p>At the end of the day, all I would like to achieve is the create a System::Collections::Generic::List type variable of type SNVT in the Viewer and then, send that variable to Tools. 
  Any idea on how I can achieve this?  </p>
  
  <p>Please note the following...
  All my classes are ref classes, except class Tools. Class Tools has to stay a native class. 
  I know this would be easier in C#, but someone else started this project in C++, so I have to continue in c++;</p>
  
  <p>// 2019-01-10
  Thank you David Yaw
  I changed the code to the following, and it works as I expected.</p>
  
  <pre><code>//*** Field.h ***\\
  public ref class Field
  {
  public:
      String^ Name;
      UInt16 Lenght;
      Field(void);
  }
  
  //*** SNVT.h ***\\
  public ref class SNVT
  {
  public:
      String^ Name;
      UInt16 Index;
      List&lt;Field^&gt; FieldList;
      SNVT(void);
  }
  
  //*** Viewer.h ***\\
  public ref class Viewer
  {
  public:
      List&lt;SNVT^&gt;^ SNVT_List; // I changed this line from List&lt;SNVT^&gt; SNVT_List;
      Viewer(void);
      SomeViewerFunction();
  }
  
  //*** Viewer.cpp ***\\
  void SomeViewerFunction()
  {
      SNVT_List = gcnew List&lt;SNVT^&gt;(); // I added this line
  
      SNVT^ currentSNVT = gcnew SNVT();
      Field^ currentField = gcnew Field();
      currentField-&gt;Name = "Field Name";
      currentField-&gt;Leght = 10;
  
      currentSNVT-&gt;Name = "SNVT Name";
      currentSNVT-&gt;Index = 1;
      currentSNVT-&gt;FieldList.Add(currentField);
  
      SNVT_List-&gt;Add(currentSNVT); // I changed this line from SNVT_List.Add(currentSNVT);
  
      Tools New_Tools;
      New_Tools.SomeToolsFunction(SNVT_List);
  }
  
  //*** Tools.h ***\\
  class Tools
  {
  public:
      Tools(void);
      SomeToolsFunction(List&lt;SNVT^&gt;^ Tools_SNVT_List); // I changed this line from SomeToolsFunction(List&lt;SNVT^&gt; Tools_SNVT_List); 
  }
  
  //*** Tools.cpp ***\\
  void SomeToolsFunction(List&lt;SNVT^&gt;^ Tools_SNVT_List) // I changed this line from void SomeToolsFunction(List&lt;SNVT^&gt; Tools_SNVT_List)
  {
  /*
  use Tools_SNVT_List here
  */
  }
  </code></pre>