這個為什麼報錯。
using System;
namespace myevent
{
public delegate void mydelegate(mystruct aa);
public struct mystruct
{
public int id;
public string name;
}
public class A
{
// private mydelegate m_Handler = null;
public event mydelegate myevent;
}
class Program
{
static void Main(string[] args)
{
mystruct mys = new mystruct();
mys.id = 100;
mys.name = "my name";
A myA = new A();
myA.myevent += new mydelegate(myA_myevent);//error???
}
public void myA_myevent(mystruct aa)
{
Console.WriteLine("用戶ID:{0},用戶名:{1}", aa.id, aa.name);
}
}
}