[ComVisible(true)]
public interface InterfaceA
{
[DispId(1)]
string Name { get; }
}
[ComVisible(true)]
public interface InterfaceB : InterfaceA
{
[DispId(2)]
void SetText(string text);
}
[ComDefaultInterface(typeof(InterfaceB))]
[ComVisible(true)]
public class ClassA : InterfaceB
{
// ...
}
I'm consuming these objects in VBScript (shoot me), but I've run into a roadblock: objects of type ClassA are only providing the functionality defined by InterfaceB explicitly. What are my options here? I require the common functionality in InterfaceA on the C# side of things. I know that explicitly declaring the elements of InterfaceA in the definition of InterfaceB with the new keyword works, but that seems incredibly inelegant. Can I do any better? There will likely be ten or so interfaces derived from InterfaceA... I've also read that I can possibly avoid this by using AutoDual, but I recall seeing Microsoft advisories against that.