Mega Code Archive

 
Categories / VB.Net / Reflection
 

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