System.Timers事件不触发,求解决解决办法
System.Timers事件不触发,求解决
没有异常,断点 GetFile();没有命中,求大神帮看看
------解决思路----------------------
执行完入口函数之后,控制台已经退出了
在main后面增加个Console.Read() 就会看到效果了
using System.Timers;
namespace TestProgram
{
class Program
{
static String RootPath = "F:\\Test1\\";
static String ObjectivePath = "F:\\Test\\";
static int a = 4;
static void Main(string[] args)
{
try
{
Timer timer = new Timer();
timer.Interval = 1000;
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Start();
}
catch (Exception e)
{
throw e;
}
}
static void timer_Elapsed(object sender, ElapsedEventArgs e)
{
GetFile();
}
没有异常,断点 GetFile();没有命中,求大神帮看看
------解决思路----------------------
执行完入口函数之后,控制台已经退出了
在main后面增加个Console.Read() 就会看到效果了