I've got a proprietary assembly with a class, which needs to be COM visible, so I can use it with other (non .NET) applications.
Imagine a class like this:
public class CProprietary
{
public CProprietary2 oSubItem;
}
public class CProprietary2
{
}
These classes are proprietary and not COM visible. I don't have the source code of them. As current solution I am creating my own assembly which provides a inherited, COM visible class.
[ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual)]
public class CComVisibleProprietary : CProprietary
{
}
Now I am able to use the base class (CProprietary) via COM, but the object of the subordinate class (CProprietary2) is still returned non COM visible when accessing CComVisibleProprietary.oSubItem.
So my problem is that I need a way to automatically wrap a class and all of its child classes. Or is there any easy way to inherit the ComVisible attribute to the child classes? Some properties of these proprietary classes also return objects of .NET like System.Windows.Forms.ListBox.ObjectCollection, so they don't belong to the same namespace.