Create an object from the assembly, passing in the correct number and type of arguments for the constructor
Imports System
Imports System.Reflection
Imports System.Security.Permissions
<assembly: AssemblyVersionAttribute("1.0.2000.0")>
Public Class Example
Private factor As Integer
Public Sub New(ByVal f As Integer)
factor = f
End Sub
Public Function SampleMethod(ByVal x As Integer) As Integer
Return x * factor
End Function
Public Shared Sub Main()
Dim assem As [Assembly] = [Assembly].GetExecutingAssembly()
Dim o As Object = assem.CreateInstance("Example", False, _
BindingFlags.ExactBinding, Nothing, _
New Object() { 2 }, Nothing, Nothing)
End Sub
End Class
Related examples in the same category