在睡前放点脑筋。但是我需要将ReadOnly Property从一个名称重新映射到我想要的指定名称。
我想我能做到
Public Readonly Property DocName as String
Get
Return Mybase.Name
End Get
End Property是的,我正在尝试重新映射XMLDocument对象的Name属性。我只想确保只要我声明这个属性,然后输入:
Public Overrides ReadOnly Property Name As String
Get
Return SomeValue
End Get
End Property我会好好多多吗?我知道我会收到method has multiple definitions with identical signatures消息,这就引出了我的第二个问题:
如何防止这种类型的声明弹出Multiple Signatures错误消息?
除非我缺少此类型重写的某些声明属性。
发布于 2012-09-07 09:11:00
您可以使用Shadows来完成此操作:
Public Class A
Public ReadOnly Property Name As String
Get
Return "Name"
End Get
End Property
End Class
Public Class B
Inherits A
Public ReadOnly Property DocName As String
Get
Return MyBase.Name
End Get
End Property
Public Shadows ReadOnly Property Name As String
Get
Return "SomeValue"
End Get
End Property
End Classhttps://stackoverflow.com/questions/12310415
复制相似问题