Get Type from Shared Method

V

Vitaly Gorbenko

Does anyony know how to get Type from shared methods?
Thank you!
Vitaly

Sub Main()
MsgBox(A.TableName)
MsgBox(B.TableName) ' I want 'B' to be displayed!!!
End Sub

Public Class A
Public Shared ReadOnly Property TableName() As String
Get
' This is where the problem is. Me.GetType may not be called
' Obviously, GetType(A) will always return Type of A
TableName = GetType(A).FullName
End Get
End Property
End Class

Public Class B : Inherits A
End Class
 
J

Jon Skeet [C# MVP]

Vitaly Gorbenko said:
Does anyony know how to get Type from shared methods?
Thank you!
Vitaly

Sub Main()
MsgBox(A.TableName)
MsgBox(B.TableName) ' I want 'B' to be displayed!!!
End Sub

The above compiles into the IL for:

MsgBox(A.TableName)
MsgBox(A.TableName)

There *is* no B.TableName property, really.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top