62,267
社区成员
发帖
与我相关
我的任务
分享//A.cs
class A
{
public delegate void EventHandler(object sender, EventArgs e);
public event EventHandler AEvent;
public void foo()
{
AEvent(this, new EventArgs());
}
}
//Program.cs
static void Main(string[] Args)
{
A a = new A();
a.AEvent += new A.EventHandler(On_AEvent);
a.foo();
}
static void On_AEvent(object sender, EventArgs e)
{
Console.WriteLine("On_AEvent");
}//A.cs
class A
{
public delegate void EventHandler(object sender, EventArgs e);
public event EventHandler AEvent;
public foo()
{
AEvent(this, new EventArgs());
}
}
//Program.cs
static void Main(string[] Args)
{
A a = new A();
a.AEvent += new A.EventHandler(On_AEvent);
a.foo();
}
static void On_AEvent(object sender, EventArgs e)
{
Console.WriteLine("On_AEvent");
}