关于自定义控件的事件问题!
if(PositionChanged!=null)
{
System.Delegate[] subScribers=PositionChanged.GetInvocationList();
foreach(System.EventHandler target in subScribers)
{
target(this,new EventArgs());
MessageBox.Show(target.ToString());
}
}
其中PositionChanged是一个事件.可是书上为什要用上边的方式去执行多点委托呢?道理是什么呢?我直接用下边的方法一样实现多点委托啊!就是直接调用委托!
PositionChanged(this,new System.EventArgs());
问题点数:20、回复次数:2Top
1 楼saucer(思归)回复于 2004-08-02 00:13:18 得分 20
yes, you can do that
but if you need to customize individual invocation, or you want to process some unseen situation, for example, an exception thrown in one of the delegates, you can use the above methodTop
2 楼wumylove1234(毁于随)回复于 2004-08-02 02:21:27 得分 0
是的,你能做
但是如果你定制个别的祈愿,或你处理一些未见过的情形, 举例来说,在代表之一被丢的例外,你能使用上述的方法
我看不懂.用快译了.
大概看明白了.五星级果然厉害.用英文回帖!Top




