日期:2014-05-18  浏览次数:20459 次

接口內怎麼定義事件啊
public   class   T1
{
        public   delegate   void   myEventHander(string   a,string   b);
        public   event   myEventHander   myEvent;
}

public   class   T2:T1,TInterface
{
   
}

public   class   T3:T1,TInterface
{
}

public   interface   TInterface
{
}
怎樣定義接口TInterface   ,另他可以調用事件myEvent呢。請各位大蝦指教。Thank   you   very   much.

------解决方案--------------------
public delegate void myEventHander(string a,string b);

public interface ITInterface
{
event myEventHander TestEvent;
void OnTestEvent();
}

给你个建议...接口命名应以字母 I 打头...
------解决方案--------------------
public interface ITInterface
{
event EventHander TestEvent;
}

接口内不允许有任何类似public ,private等修饰