Get constructor info through reflection

Imports System.Reflection
Module Module1
    Private type As Type = Nothing
    Private assem As Assembly
    Private constr As ConstructorInfo
    Private parameterInfo As ParameterInfo

    Sub Main()
        assem = Assembly.LoadFrom("F:\Practice\csdn\ConsoleApplication1\ClassLibrary1\bin\Debug\ClassLibrary1.dll")
        'For Each type In assem.GetTypes()
        type = assem.GetType("ClassLibrary1.Class1")

        Console.WriteLine(type.Name.ToString)
        For Each constr In type.GetConstructors()
            For Each parameterInfo In constr.GetParameters
                Console.WriteLine("{0} {1} {2}", parameterInfo.ParameterType.FullName, parameterInfo.Name, parameterInfo.IsOptional)
            Next
        Next
        Console.Read()
    End Sub

End Module

转载于:https://www.cnblogs.com/yangbin990/archive/2009/08/28/1555995.html