Public Class Component1

    Public ReadOnly InstanceID As Integer

    Private Shared NextInstanceID As Integer = 0

    Private Shared ClassInstanceCount As Long = 0

   

    Protected Overrides Sub Finalize()

        ClassInstanceCount -= 1

    End Sub

    Public Shared ReadOnly Property InstanceCount() As Long

        Get

            Return ClassInstanceCount

        End Get

    End Property

End Class