【发布时间】:2013-12-27 15:15:21
【问题描述】:
我有一个与quartz.net cron 表达式有关的问题。看了很多文章,尝试了很多代码,但没有任何结果,所以我觉得有点绝望,这就是为什么我决定问你。也许有人也有类似的问题。 有什么方法可以将 Quartz.Net 的 cron 表达式解析为 DateTime 格式? 例如我有一个 cron:
var cron = new Quartz.CronExpression("0 * 8-22 * * ?");
我已经尝试使用 GetFinalFireTime() GetTimeAfter() GetNextValidTimeAfter() 但应用程序仍然抛出异常:
An unhandled exception of type 'System.AccessViolationException' occurred. Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
这是我的代码:
CronExpression cron = new Quartz.CronExpression("0 * 8-22 * * ?");
DateTimeOffset? nextFire = cron.GetNextValidTimeAfter(dt);
如果您能告诉我是否有任何可以轻松创建 crons 的 cron 解析器库,我也将非常感激。类似于 cronMaker.com,但可以与 Quartz.Net 一起使用。
【问题讨论】:
标签: c# .net cron quartz.net