How can I manipulate a VB6 Collection in .NET?

送分小仙女□ 提交于 2019-12-22 10:38:32

问题


I am currently in the process of designing an interface for .NET software that would be consumed by COM objects - specifically, VB6.

While I have found a number of pages by Microsoft detailing how to make an COM-interoperable interface, I am currently tripping over the use of Collections in design time: I would like to be able to use a standard VB6 "Collection object" in the .NET program - that way, I would be able to specify, in the interface, such a collection as an argument, or as a return type, simplifying the work required for clients to use the interface.

Thank you in advance.

Edit: I don't intend to use VB6 collections in the "real work" .NET program - I would convert the VB6 collections as soon as possible and call other methods using proper .NET collections.


回答1:


You shouldn't use a type such as the Collection Object from the Visual Basic Runtime in .NET.
Instead you should try to find an equivalent class in the System.Collections namespace that best suits your needs. Check out the following article for some guidance:

  • Using collections in .NET


来源:https://stackoverflow.com/questions/2948121/how-can-i-manipulate-a-vb6-collection-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!