LSharp
LSharp copied to clipboard
event事件bug
现象一:
例如:在一个类里面定了一个事件
class One
{
public static event System.Action
执行到UserLoginEvent+=MyFun;语句,提示UserLoginEvent为空,暴异常。而是用 UserLoginEvent=MyFun;第一次使用就可以。
现象二: 在上面现象一的基础上,在另外一个类里面。 class Two { .... One.UserLoginEvent+=TheOtherFun; ....
public void TheOtherFun(int beh) { } }
执行到UserLoginEvent+=TheOtherFun;语句,提示UserLoginEvent为空,暴异常.而实际应用中,TheOtherFun函数响应了。 类One在类Two之前就先实例化了。