由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - a C# question
相关主题
想破脑壳也不知道为什么finally不执行one question about threading
vb.net event handler 请教!如何raise一个event,所有form中任何一个on top的可以handle? 又一个教你怎么做GALLERY的
问appSettingsC# listview中的动态查找
你们最不喜欢.net的什么?Thread suspend and resume
Event trackingQ: Radiobuttonlist - select item in Datalist
how to write an object into xml with c#Look for a reliable ajax framework
microsoft .net event为什么我的vs2005不能打开Access文件
.NET, 怎样初始化动态树祖请问.Net相关的工作,面试是什么风格的?
相关话题的讨论汇总
话题: class1话题: handlers话题: c#话题: h1话题: question
进入DotNet版参与讨论
1 (共1页)
s*i
发帖数: 5025
1
Suppose you have a class (class1), with an event (e). Then you may add many
handlers (h1, h2, ...) like this:
class1.E+=h1;
class1.E+=h2;
.....
You may also remove some during run time like thisL
class1.E-=h1;
...
Now my question is : is there an easy way to find out all the handlers that
are associated with the class event?
c**e
发帖数: 2558
2
if you have access to class1's code, you can call GetInvocationList() on E
from within the class and return the handlers as Delegate[] to the client code
.
i don't think code outside class1 can directly manipulate E because the whole
point of decorating E with the 'event' keyword is to prevent it from being
raised by classes other than class1.
you might be able to get around that limitation, or feature rather, using
reflection, but i doubt it.

【在 s*i 的大作中提到】
: Suppose you have a class (class1), with an event (e). Then you may add many
: handlers (h1, h2, ...) like this:
: class1.E+=h1;
: class1.E+=h2;
: .....
: You may also remove some during run time like thisL
: class1.E-=h1;
: ...
: Now my question is : is there an easy way to find out all the handlers that
: are associated with the class event?

1 (共1页)
进入DotNet版参与讨论
相关主题
请问.Net相关的工作,面试是什么风格的?Event tracking
who can solve this?how to write an object into xml with c#
C# on JVM?microsoft .net event
请问, ASP.NET 中, 2 个web form之间如何传参数?.NET, 怎样初始化动态树祖
想破脑壳也不知道为什么finally不执行one question about threading
vb.net event handler 请教!如何raise一个event,所有form中任何一个on top的可以handle? 又一个教你怎么做GALLERY的
问appSettingsC# listview中的动态查找
你们最不喜欢.net的什么?Thread suspend and resume
相关话题的讨论汇总
话题: class1话题: handlers话题: c#话题: h1话题: question