c# windows 服务 - 不完全是间隔

c# windows service - not quite the intervals

    private const int intervalTime = 5;



    protected override void OnStart(string[] args)
    {
    }
    public long DoSomething()
    {
        intervalStopWatch.Reset();
        intervalStopWatch.Start();
        facade.Execute();
        intervalStopWatch.Stop();
        return intervalStopWatch.ElapsedMilliseconds;
    }

你好,我想创建类似于间隔的服务,但我的目的是计算函数的执行时间"DoSomething",如果这个时间 >= intervalTime 调用这个函数,如果不是,等到它超过间隔时间,然后调用该函数。这样做的最佳做法是什么?而且真的不知道该怎么做。

查看 quartz.net,似乎正是您所需要的