|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Subject: Question: Dynamically Raise Event using Reflection APIHi there,
I tried to find a way to dynamically raise event using Reflection API. The scenario is, I have to raise a event in a class instance by using a given event name. I can use the GetEvent(...) method of the Reflection API to get the EventInfo object. However, the GetRaiseMethod of the EventInfo object is always null. And I haven't found another way other than this to dynamically raise an event of a .NET class. Have anyone ideas about how to do it? Any help is greatly appreciated! -- KIM I've recently been reflecting on methods in a class, and I believe I saw
some methods with names like raise_XXXX. Try using GetMethods(BindingFlags.Instance|BindingFlags.NonPublic) on your type. Unfortunately, I don't have things set up at the moment to quickly double-check that for you. -- Noah Show quote "KIM" <K**@discussions.microsoft.com> wrote in message news:C400917C-423B-4199-B71E-F8DCEF5C3A46@microsoft.com... > Hi there, > > I tried to find a way to dynamically raise event using Reflection API. The > scenario is, I have to raise a event in a class instance by using a given > event name. I can use the GetEvent(...) method of the Reflection API to > get > the EventInfo object. However, the GetRaiseMethod of the EventInfo object > is > always null. And I haven't found another way other than this to > dynamically > raise an event of a .NET class. > > Have anyone ideas about how to do it? Any help is greatly appreciated! > > -- > KIM |
|||||||||||||||||||||||