Mega Code Archive

 
Categories / VB.Net / Reflection
 

Type GetConstructor (BindingFlags, Binder, Type[], ParameterModifier[])

Imports System Imports System.Reflection Imports System.Security Public Class MyClass1     Public Sub New(ByVal i As Integer)     End Sub 'New     Public Shared Sub Main()         Try             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, types, Nothing)             If Not (constructorInfoObj Is Nothing) Then                 Console.WriteLine(constructorInfoObj.ToString())             End If         Catch e As Exception             Console.WriteLine("Exception: " + e.Message)         End Try     End Sub End Class