c# enumerable class - compatible with VBA

流过昼夜 提交于 2019-11-30 20:19:38

Try adding [DispId(-4)] to your GetEnumerator() method. This flags it to be the DISPID_NEWENUM member. In order for VBA to work with a collection using For Each, it needs to implement _newEnum via COM.

This can be done by implementing an Enumerator and attributing it with the proper DispId. This is typically done via implementing a custom interface with this specified, though there are other mechanisms available.

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