reflection apoi

  • Thread starter Thread starter crain
  • Start date Start date
C

crain

hi i have an assembly that has a funciton hello that simply returns a
string.

Dim a As Reflection.Assembly =
Reflection.Assembly.LoadFrom("E:\Practice\ClassAssembly\obj\Debug\ClassAssem
bly.dll")
Dim types() As Type = a.GetTypes()
Dim t As Type
For Each t In types
MessageBox.Show(t.FullName())
Dim mm() As MemberInfo
Dim m As MemberInfo
mm = t.GetMembers()
For Each m In mm
MessageBox.Show(m.MemberType.ToString() + " " + m.Name)
Next
Next

this is my code to get all the methods in the assembly. how do i know that
hello is a userdefined function because this code returns all the methods.
thanx
 
I don't think reflection shows which methds are userdefined and which are
define by framework. I think the easiest way to diferentiate would be to
declare an interface with your functions and then implement the interface on
your classes, then you could get the interface and all its methods and then
check what classes implement the interface.

hth

Fitim Skenderi
 
Back
Top