Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflection.Emit namespace. Word of advice, load the dynamic assembly
into a new AppDomain so you can unload it.
Alternatively you could use System.CodeDom to create a source module that
you later compile.
In either case you probably could have written a single module faster and
manually handle all the events! However! You would not have a cool utility
worth sharing, that would handle events out of any source. Of course if you
are going the cool utility route, be sure we can choose which events we want
handled! And post the utility on
www.gotdotnet.com or someplace were the
rest of us can use it!
BTW: Dynamically handling events I think would be handy for utilities such
as
www.nunit.org &
www.csunit.org. Have an attribute that says this method
should raise this event. The tool would dynamically handle the event to be
certain it was raised. Similar to how they handles Exceptions.
Hope this helps
Jay
"Erik Frey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I was wondering if there was a -clever- way of doing it, dynamic for
an
> object you choose.
>
> My initial thoughts were to use reflection to loop through all the
event
> signatures - I imagine you can do that. And adding a handler, with some
> kind of dynamically created method? Maybe? I don't even know if such a
> thing is possible.
>
> "Stephany Young" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Put a concole.writeline in an eventhandler for every event for the
object
> in
> > question.
> >
> > "Erik Frey" <(E-Mail Removed)> wrote in message
> > news:OxI$(E-Mail Removed)...
> > > Hi there,
> > >
> > > Just curious as to whether there's a clever way to see the events
a
> > > control/object is firing off, perhaps written out to the debug
console.
> > It
> > > would be really handy to know which events a control is firing when I
> > > perform a certain action, and the order in which they are occurring.
> > >
> > > Thanks,
> > >
> > > Erik
> > >
> > >
> >
> >
>
>