// 设备启动事件
    public event EventHandler<StartArgs> EventStart;
    public class StartArgs : EventArgs { /* 空 */ }    // 设备停止事件
    public event EventHandler<StopArgs> EventStop;
    public class StopArgs : EventArgs { /* 空 */ }
因所需信息均可从 sender 获取,故如此,不知妥否。

解决方案 »

  1.   

    那我调用时是 EventStart(this, null); 好,还是 EventStart(this, new StartArgs()); 这样好?
    顺便,EventHandler<T> 会自己检查空值吗,if (EventStart != null) EventStart(this, null); 有无必要?
      

  2.   

    如果跟参数无关的话  
    没有必要EventStart(this, new StartArgs())
    也没有必要声明2个参数类
    更没必要if (EventStart != null) 
      

  3.   

    额...看错了  最后一个if (EventStart != null) 还是需要的
      

  4.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;class MyT
    {
        public event EventHandler<StartEventArgs> Started;
        public class StartEventArgs : EventArgs { }
        public void Start()
        {
            Console.WriteLine("MyT Start!");
            Started(this, null);    // 直接来试试
        }
    }namespace test5
    {
        class Program
        {
            static void Fun1(object sender, EventArgs e)
            {
                Console.WriteLine("Fun1");
            }
            static void Main(string[] args)
            {
                MyT myt = new MyT();
                //myt.Started += Fun1;
                myt.Start();
            }
        }
    }还真的有异常,未处理的异常:  System.NullReferenceException: 未将对象引用设置到对象的实例。
       在 MyT.Start() 位置 D:\test5\Program.cs:行号 13
       在 test5.Program.Main(String[] args) 位置 D:\test5\Program.cs:行号 29