G
Guest
Hello,
Is there any way of getting currently instantiated class name from a parent
class's shared readonly property? I would need to know which actual class
(that was derieved from the class containing the shared property) is trying
to get the shared property value. It would be something like this:
Public Class BaseClass
Public Shared ReadOnly Property PageConfig() As PageConfiguration
Get
Return PageConfigurator.GetConfig( [here i would like a derieved
class's name, if called through that] )
End Get
End Property
End Class
Public Class DerievedClass
Inherits BaseClass
Public Sub SomeMethod()
PageTitle = Me.PageConfig.Title
End Sub
End Class
Why does it need to be Shared? I need to call it also for the derieved class
from any other class that has nothing to do with the two above without
creating an instance of derieved class, like:
Public Class AnotherClass
Public Sub SomeMethod
Dim TargetUrl As String = DerievedClass.PageConfig.Url
End Sub
End Class
Am I missing something? Is this possible at all? This is so trivially used
in my projects and there are so many derieving classes that I would like to
accomplish this task without needing to code anything in derieving classes.
I've tried something with gettype and reflection without success.
Any help appriciated,
Pasi Häkkinen
Is there any way of getting currently instantiated class name from a parent
class's shared readonly property? I would need to know which actual class
(that was derieved from the class containing the shared property) is trying
to get the shared property value. It would be something like this:
Public Class BaseClass
Public Shared ReadOnly Property PageConfig() As PageConfiguration
Get
Return PageConfigurator.GetConfig( [here i would like a derieved
class's name, if called through that] )
End Get
End Property
End Class
Public Class DerievedClass
Inherits BaseClass
Public Sub SomeMethod()
PageTitle = Me.PageConfig.Title
End Sub
End Class
Why does it need to be Shared? I need to call it also for the derieved class
from any other class that has nothing to do with the two above without
creating an instance of derieved class, like:
Public Class AnotherClass
Public Sub SomeMethod
Dim TargetUrl As String = DerievedClass.PageConfig.Url
End Sub
End Class
Am I missing something? Is this possible at all? This is so trivially used
in my projects and there are so many derieving classes that I would like to
accomplish this task without needing to code anything in derieving classes.
I've tried something with gettype and reflection without success.
Any help appriciated,
Pasi Häkkinen