Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event事件bug #24

Open
Gavin991 opened this issue Apr 8, 2015 · 0 comments
Open

event事件bug #24

Gavin991 opened this issue Apr 8, 2015 · 0 comments

Comments

@Gavin991
Copy link

Gavin991 commented Apr 8, 2015

现象一:
例如:在一个类里面定了一个事件
class One
{
public static event System.Action UserLoginEvent;
.....
UserLoginEvent+=MyFun;
. ....
public void MyFun(int beh)
{
}
}

执行到UserLoginEvent+=MyFun;语句,提示UserLoginEvent为空,暴异常。而是用
UserLoginEvent=MyFun;第一次使用就可以。

现象二:
在上面现象一的基础上,在另外一个类里面。
class Two
{
....
One.UserLoginEvent+=TheOtherFun;
....

public void TheOtherFun(int beh)
{
}
}

执行到UserLoginEvent+=TheOtherFun;语句,提示UserLoginEvent为空,暴异常.而实际应用中,TheOtherFun函数响应了。
类One在类Two之前就先实例化了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant