Reputation: 401
sample.vb
class sam
public shared sub hh()
Console.WriteLine("asasas")
end sub
end class
test.vb
Dim ass as Assembly = Assembly.LoadFile("sample.dll")
Now, I want to call the shared method using the class name.How do i do that??
Upvotes: 0
Views: 2718
Reputation: 29244
Reflection is your friend. Add a Imports System.Reflection
and try the following:
Sub Main()
Dim ass As Assembly = Assembly.LoadFile("sample.dll")
Dim t_sam As Type = ass.GetType("sam")
Dim hh_m As MethodInfo = t_sam.GetMethod("hh", BindingFlags.Public Or BindingFlags.Static)
hh_m.Invoke(Nothing, New Object() {})
End Sub
Upvotes: 2