I am following @Craig's comment. I just don't feel it's elegant.
So I basically add this function
Protected Sub updateTypeName()
_TypeName = Me.GetType().Name
End Sub
And then I do
Public Sub New(ByVal ParamArray kwargs As EIP712Type())
MyBase.New("", Nothing) ' Assuming EIP712Type has a constructor like this
updateTypeName()
Dim members As List(Of Tuple(Of String, EIP712Type)) = GetMembers()
values = New Dictionary(Of String, EIP712Type)
So the TypeName is defined as
Public ReadOnly Property TypeName As String
and it's readonly and can only be modified by descendants of EIP712Type and they can only do so by changing the name to the actual name of the class.
If there is a more elegant solution I would like to know.
The issue is VB should already know the type of the class calling new variable. However, unlike in many of other programming language, VB doesn't have a keyword to refer to that class. Me refer to the object. Python usually have self and cls and that has no equivalent in VB.
I maybe missing something.