MulticastDelegate 集成于Delegate;
在使用的的时候,首先在基础model类中声明事件定义
public event AAAEventHandler AAAReceived
{
add{ }
remove{ }
};事件的包装
public delegate void AAA(pragam1,pragam2)
在viewmodel中对事件进行注册 :
AAAReceived += new AAAEventHandler(function fun);
public static void fun(pragam1,pragam2){ ........ }
调用委托函数:
Delegate[] delegates = AAA.GetInvocationList(); //注意这里的delegates列表中存储的是AAA类型的委托 foreach (AAA aa in delegates) { AAA(pragam1,pragam2); }