Retrieve all the public methods and their type

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I want to iterate through a class and retrieve a list of all the public
members (and their type if possible) for it to display on the screen. Then
I want to be able to access those methods through a variable. Is this even
possible? What topics do I need to look into for this?

Thanks
Chris
 
Chris said:
I want to iterate through a class and retrieve a list of all the public
members (and their type if possible) for it to display on the screen. Then
I want to be able to access those methods through a variable. Is this even
possible? What topics do I need to look into for this?

Look into System.Reflection, and the Type.GetMethods method.
 
Dim sReturn As String
Dim a As [Assembly] = [Assembly].Load("YrAsmbly")
Dim myTypes As Type() = a.GetTypes()
Dim t As Type
Dim flags As BindingFlags = BindingFlags.Public Or
BindingFlags.Static

For Each t In myTypes
If t.Name = "yrclass" Then
Dim fldInfo As PropertyInfo
Dim arrfldInfo() As PropertyInfo
arrfldInfo = t.GetProperties()
For Each fldInfo In arrfldInfo
debug.write fldInfo.Name
Next
End If
Next t
 
Back
Top