Without using p/invoke, from a C++/CLI I have succeeded in integrating various methods of a DLL library from a third party built in C.
One of these methods retrieves information from a database and stores it in different structures. The C++/CLI program I wrote reads those structures and stores them in a List<>, which is then returned to the corresponding reading and use of an application programmed completely in C#. I understand that the double handling of data (first, filling in several structures and then, filling all of these structures into a list<>) may generate an unnecessary overload, at which point I wish C++/CLI had the keyword “yield”.
Depending on the above scenario, do you have recommendations to avoid or reduce this overload?
Thanks.
You do not need the
yieldkeyword to create iterators. Just create one class implementingIEnumerator<T>and another class implementingIEnumerable<T>.