I've got a 2.0 .NET assembly class that I need to expose to COM.
Most of the items in it's interface are pretty straight forward,
booleans, strings, etc.
One property however, returns a HashTable when consumed in .NET. What's
the sanest way to get this data out of .NET from within COM, and still
be able to treat it like it has an _Enum interface?
I started down the path of creating a new class, MyCollection, that
inherits HasTable. That class has ComDefaultInterface set to
IDictionary, and MyCollection Implements the IDictionary interface.
Within COM, I can instantiate the parent class, get back the
MyCollection class from the property in question. I can act on that
class using the usual clear/contains/add type things.
From here, I'm totally lost as to where to go next to be able to tack on
an _Enum to allow COM to be able to enumerate my class collection:
Set objParent = CreateObject("My.NET.Assembly")
objParent.MyCollection..Add("foo", "bar")
For Each objItem In objParent.MyCollection
...
Next
Is such a thing even possible, is this the dark nasty part of COM interop?
-=Chris