.Net Assembly with inherited classes exposed to Com Client through Interop


I am trying not to use ClassInterfaceType.AutoDual on my class since a number of articles recommend against it.
I understand that I need to explicitly set my Interface. My problem is I can not figure out how to handle the fact that most of my classes have inherited public properties that I wish to expose to my Com Client. Below is a simple example of what I am trying to do. I have a Base Class "A" that has a public method "x", I then have a Class "B" that Inherits from the base class "A". Class "B" has an additional public method "y". I am trying to get Class "B" in my Com client show both "x", and "y". I currently can only get it to show "y".
Any insight would be greatly appreciated


Imports System.Runtime.InteropServices

<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
Public Interface IA

Sub x()
End Interface

<ClassInterface(ClassInterfaceType.None)> _
Public Class A
Implements IA

Public Sub x() Implements IA.x
' code
End Sub

End Class

<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
Public Interface IB
Inherits IA

Sub y()

End Interface


<ClassInterface(ClassInterfaceType.None)> _
Public Class B
Inherits A
Implements IB

Public Sub y() Implements IB.y
End Sub


End Class



Answer this question

.Net Assembly with inherited classes exposed to Com Client through Interop

  • .Net Assembly with inherited classes exposed to Com Client through Interop