What is the most efficient way to convert a std::vector to a .NET List?
To give some context, I am wrapping an unmanaged C++ class with C++/CLI. The C++/CLI class holds
I am not familiar with C++-CLI but one small improvement you can make is to create your list with the right capacity from the beginning.
List list = gcnew List(runList.size());
Another improvement would be to pre-increment your C++ iterator instead of post-incrementing it because currently you create an extra object for every element that is discarded immediately.