S
Steve
Hi all
If there is a more relevant NG for my question about Reflection I would be
grateful if some-one could point me in the right direction!
I am using the following code to get the Public Methods, Properties and
Events from a particular Assembly, but some extra methods are being listed.
How can I get all the Public Methods, Properties and Events in an Assembly
that I've created?
-------------------------------------------------
Private Sub GetAssemblyDetails()
Dim oAssembly As [Assembly] = [Assembly].LoadFrom(txtPath.Text)
Dim oType As Type
For Each oType In oAssembly.GetTypes
For Each m_oMethod In oType.GetMethods(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstMethods.Items.Add(m_oMethod.Name)
Next
For Each m_oProperty In oType.GetProperties(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstProperties.Items.Add(m_oProperty.Name)
Next
For Each m_oEvent In oType.GetEvents(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstEvents.Items.Add(m_oEvent.Name)
Next
Next
End Sub
----------------------------------------------
The extra things I get are items like get_Version (Version is a property
that is being returned), but also add_InfoMessage (InfoMessage is an Event
that is being returned). How do I eliminate these from my list?
Also, is there a way to just get the information from 1 class. My Assembly
has several classes and will inherit from others, but I just want to return
the information for 1 of the classes.
Thanks in advance.
Regards,
Steve.
If there is a more relevant NG for my question about Reflection I would be
grateful if some-one could point me in the right direction!
I am using the following code to get the Public Methods, Properties and
Events from a particular Assembly, but some extra methods are being listed.
How can I get all the Public Methods, Properties and Events in an Assembly
that I've created?
-------------------------------------------------
Private Sub GetAssemblyDetails()
Dim oAssembly As [Assembly] = [Assembly].LoadFrom(txtPath.Text)
Dim oType As Type
For Each oType In oAssembly.GetTypes
For Each m_oMethod In oType.GetMethods(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstMethods.Items.Add(m_oMethod.Name)
Next
For Each m_oProperty In oType.GetProperties(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstProperties.Items.Add(m_oProperty.Name)
Next
For Each m_oEvent In oType.GetEvents(BindingFlags.Public Or
BindingFlags.Instance Or BindingFlags.DeclaredOnly)
lstEvents.Items.Add(m_oEvent.Name)
Next
Next
End Sub
----------------------------------------------
The extra things I get are items like get_Version (Version is a property
that is being returned), but also add_InfoMessage (InfoMessage is an Event
that is being returned). How do I eliminate these from my list?
Also, is there a way to just get the information from 1 class. My Assembly
has several classes and will inherit from others, but I just want to return
the information for 1 of the classes.
Thanks in advance.
Regards,
Steve.