reflection

  • Thread starter Thread starter Perecli Manole
  • Start date Start date
P

Perecli Manole

Is there a way to reflect the events in a class that are declared as
"Friend"?

Dim objEventDescriptors As EventDescriptorCollection =
TypeDescriptor.GetEvents(Me, New Attribute() {New
ScriptEventAttribute(True)})
For Each objEventDesc As EventDescriptor In objEventDescriptors
'do stuff
Next


The above code works only for "Public" events but I want to get the events
that are declared with "Friend" access. I am running this code from the
local DLL so it has access to "Friend" events.

Perry
 
You could try this instead:

dim f as new foo()
Dim publicevents() As EventInfo =
f.GetType().GetEvents(BindingFlags.Instance Or BindingFlags.Public)
Dim privateevents() As EventInfo =
f.GetType().GetEvents(BindingFlags.Instance Or BindingFlags.NonPublic)

Hope that helps,
Ralph Shillington
Check out Coffee Break Tutorials (http://www.ifoundtime.com/
community)
for 3 to 5 minute video demonstrations of common .NET and SQL Server
develpoment questions.
 
Back
Top