c#自定义事件

来源:互联网 发布:怎么看自己淘宝联盟pid 编辑:程序博客网 时间:2024/06/05 09:37

1.声明事件

 public event EventHandler<SelectedBvEventArgs> SelectedBv;

2.定义事件参数

 public class SelectedBvEventArgs : EventArgs    {        public SelectedBvEventArgs(string    strSelectName,string strEcuName,string strProtocol)        {            this.strBvName = strSelectName;            this.strEcuName = strEcuName;            this.strProtocol = strProtocol;        }        public string strBvName { get; private set; }        public string strEcuName { get; private set; }        public string strProtocol { get; private set; }    }

3.触发事件

SelectedBv(this, new SelectedBvEventArgs(strSelectName,strEcuName,strProtocl));
0 0
原创粉丝点击