如何访问未在其实现的接口中声明的类的属性?
Interface IMyInterface
Property MyInterfaceProperty As String
End Interface
Public Class MyImplementingClass
Implements IMyInterface
Public Property MyClassProperty As String
Public Property MyInterfaceProperty As String Implements IMyInterface.MyInterfaceProperty
End Class
Public Class MyTestClass
Public Sub New()
Dim foo As IMyInterface = New MyImplementingClass
foo.MyInterfaceProperty = "foo"
foo.MyClassProperty = "bar" '### Compile Error MyClassProperty is not a member of IMyInterface
End Sub
End Class
我已尝试添加
foo = CType(foo, MyImplementingClass)
但它不起作用......