Fast exchange of data between unmanaged code and managed code
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 yield
keyword to create iterators. Just create one class implementing IEnumerator<T>
and another class implementing IEnumerable<T>
.
精彩评论