Search code examples
vb.nettypesinstance

Get the type of my current class in VB.net


Public Sub New()
    If GridElement.typeList(getId(), getLayer()) Is Nothing Then
        GridElement.typeList(getid(),getlayer()) = GetType(me)
    End If
End Sub

Take a look at the snippet above. On the third line, I'm trying to set a multidimensional array to the type that the current class is. How can I get the type of the class that I am currently in?

I'm using VB.net so all .net examples are acceptable.


Solution

  • Just call GetType() (i.e. effectively me.GetType()) - you're already in an instance.