问题描述
///<summary>///论坛基本设置类///</summary>publicclassGeneralConfigs{privatestaticobjectlockHelper=newobject();privatestaticSystem.Timers.TimergeneralConfigTimer=newSystem.Timers.Timer(15000);privatestaticGeneralConfigInfom_configinfo;///<summary>///静态构造函数初始化相应实例和定时器///</summary>staticGeneralConfigs(){m_configinfo=GeneralConfigFileManager.LoadConfig();generalConfigTimer.AutoReset=true;generalConfigTimer.Enabled=true;generalConfigTimer.Elapsed+=newSystem.Timers.ElapsedEventHandler(Timer_Elapsed);generalConfigTimer.Start();}privatestaticvoidTimer_Elapsed(objectsender,System.Timers.ElapsedEventArgse){ResetConfig();}///<summary>///重设配置类实例///</summary>publicstaticvoidResetConfig(){m_configinfo=GeneralConfigFileManager.LoadConfig();}publicstaticGeneralConfigInfoGetConfig(){returnm_configinfo;}}
代码如下,C#实例化对像的时候为什么要启用定时器,是不是定时更新
解决方案
解决方案二:
你去问写代码的人