ConstructorInfo Class represents the attributes of a class constructor : ConstructorInfo « Reflection « VB.Net






ConstructorInfo Class represents the attributes of a class constructor

 

Imports System.Reflection

Public Class MyClass1
    Public Sub New(ByVal i As Integer)
    End Sub
    Public Shared Sub Main()
        Dim myType As Type = GetType(MyClass1)
        Dim types(0) As Type
        types(0) = GetType(Integer)
        Dim constructorInfoObj As ConstructorInfo = _
                    myType.GetConstructor(BindingFlags.Instance Or _
                    BindingFlags.Public, Nothing, _
                    CallingConventions.HasThis, types, Nothing)
        If Not (constructorInfoObj Is Nothing) Then
            Console.WriteLine(constructorInfoObj.ToString())
        End If
    End Sub
End Class

   
  








Related examples in the same category

1.ConstructorInfo.MemberType gets a MemberTypes value indicating that this member is a constructor.