|
-
Aug 13th, 2012, 06:34 AM
#2
Re: Trouble with reflection
Of course you can't, because 'o' is type Object. Does the Object class have any events? You're using Reflection, which means discovering types and members at run time. If you create an object by Reflection then you have to access its members by Reflection too. The PropertyInfo class is used to represent properties, the MethodInfo class is used to represent methods and the EventInfo class is used to represent events. You can call GetType on your object and then call GetEvent or GetEvents on that to get one or multiple EventInfo objects. Once you have an EventInfo object, you call its AddEventHandler method to add a handler for that event to your original object. I think that you probably need to do some more general reading on how Reflection works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|