0
Answer

Exposure of an interface's parent interface to COM

Marco Parreira

Marco Parreira

17y
1.5k
1
Suppose you have the following piece of code:

...

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IMyParentInterface
{
     string MyParentString{get;set;}
}

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IMyStringInterface : IMyParentInterface
{
     string MyString{get;set;}
}

[ClassInterface(ClassInterfaceType.None)]
public class MyClass: IMyStringInterface
{
    private string _mystring;
    public string MyString
    {
        get { return _mystring; }
        set { _mystring = value; }
    }

    private string _myparentstring;
    public string MyParentString
    {
        get { return _myparentstring; }
        set { _myparentstring = value; }
    }
}

...


Anyone knows how can we access MyClass.MyParentString from COM?