private void objTimerModbusTCP_Elapsed(object sender, EventArgs e) { ModbusTCP.ModbusTCP objModbusTCP = new ModbusTCP.ModbusTCP(); try { // Do something here! g_oLogger.Info("TimerModbusTCP Run Time--" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); objModbusTCP.Start(); } catch (Exception ex) { g_oLogger.ErrorException("Service1.objTimerModbusTCP_Elapsed", ex); } finally { if (objModbusTCP != null) { objModbusTCP = null; } } }