As far as I'm aware you can't marshall something like a list, because these sorts of objects are implemented differently across C# and C++. You need to instead look at returning or consuming something much simpler, like an array instead. I'd recommend having the C++ method require an array of
Data
and also provide an
int
indicating the length of the array. You could then convert it into a list within the C++ method to perform whatever operations you need.
c++ - How to return a list in C# using P/Invoke? - Stack Overflow[
^]