C#的静态类不支持委托和事件吗?

解决方案 »

  1.   

    请问楼主你自己有没有先实际敲代码验证下啊?
    以下是我自己以前项目的部分代码
      public static class DataCoreEvent
        {
            //触发数据库或者文件数据库事件
            #region fire Log Event
            public static event DataCoreLogDelegate DataCoreLogEvent;
            public static void FireLog(string classname, string methodname, string des)
            {
                if (DataCoreLogEvent != null)
                    DataCoreLogEvent(classname, methodname, des);
            }
      

  2.   

    我自己有验证啊,发现声明委托的时候,老提示 "修饰符'static'对该项无效".所以我就怀疑是否支持
      

  3.   

    知道了 委托不能用static修饰  谢谢大家
      

  4.   

        internal static class GHFLBMConvertFunctions
        {
            private static delegate Boolean dlAdjust(String dlbm);以上代码出来的提示是:The modifier 'static' is not valid for this item
    事件是支持的,不支持委托。
      

  5.   

    事件可以为static,委托不能为static
    在静态类中,可以使用事件的
    public delegate void ServerDone(DataTable dt,string state);
    public static event ServerDone OnServerDoneHandler;