非托管代码和托管代码之间的快速数据交换
在不使用 p/invoke 的情况下,我从 C++/CLI 成功集成了来自 C 内置第三方的 DLL 库的各种方法。
其中一种方法从数据库检索信息并将其存储在不同的结构中。我编写的C++/CLI程序读取这些结构并将它们存储在List<>中,然后返回到完全用C#编程的应用程序的相应读取和使用。我知道数据的双重处理(首先,填充几个结构,然后将所有这些结构填充到列表中)可能会产生不必要的重载,此时我希望 C++/CLI 有关键字“yield” 。
根据上述情况,您是否有避免或减少这种过载的建议?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要
yield
关键字来创建迭代器。只需创建一个实现IEnumerator
的类和另一个实现IEnumerable
的类。You do not need the
yield
keyword to create iterators. Just create one class implementingIEnumerator<T>
and another class implementingIEnumerable<T>
.