简体   繁体   English

无法隐式转换类型&#39;System.Threading.tasks.task <Quartz.Scheduler> 至 <Quartz.IScheduler>

[英]cannot implicitly convert type 'System.Threading.tasks.task<Quartz.Scheduler> to <Quartz.IScheduler>

public void Start()
    {

        ISchedulerFactory schedFact = new  StdSchedulerFactory();

        IScheduler sched = schedFact.GetScheduler();
        sched.Start();

        IJobDetail job = JobBuilder.Create<EmailJob>()
            .Build();

        ITrigger trigger = TriggerBuilder.Create()
          .StartNow()
          .WithSimpleSchedule(x => x

              .WithIntervalInHours(48)
              .RepeatForever())
          .Build();

        sched.ScheduleJob(job, trigger);
    }

I'm getting error in IScheduler sched = schedFact.GetScheduler(); 我在IScheduler sched = schedFact.GetScheduler();遇到错误IScheduler sched = schedFact.GetScheduler();

It says 它说

"cannot implicitly convert type System.Threading.tasks.task Quartz.Scheduler to Quartz.IScheduler" “无法将类型System.Threading.tasks.task Quartz.Scheduler隐式转换为Quartz.IScheduler”

schedFact.GetScheduler(); returns Task You should use the following code to get IScheduler object: 返回Task应该使用以下代码获取IScheduler对象:

IScheduler sched = schedFact.GetScheduler().GetAwaiter().GetResult();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将类型&#39;bool&#39;隐式转换为&#39;System.Threading.Tasks.Task&#39; - Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task' 无法将类型&#39;void&#39;隐式转换为&#39;System.Threading.Tasks.Task&#39; - Cannot implicitly convert type 'void' to 'System.Threading.Tasks.Task' 无法隐式转换类型&#39;System.Threading.Tasks.Task - Cannot implicitly convert type 'System.Threading.Tasks.Task 无法将类型&#39;System.Collections.Generic.List &lt;&gt;&#39;隐式转换为&#39;System.Threading.Tasks.Task &lt;&gt;&gt; - Cannot implicitly convert type 'System.Collections.Generic.List<>' to 'System.Threading.Tasks.Task<>> 无法将布尔类型隐式转换为System.Threading.Tasks.Task <bool> - Cannot implicitly convert type bool to System.Threading.Tasks.Task<bool> 无法将类型“字符串”隐式转换为“System.Threading.Tasks.Task”<string> &#39; - Cannot implicitly convert type 'string' to 'System.Threading.Tasks.Task<string>' 无法将类型“字符串”隐式转换为“System.Threading.Tasks.Task”<string> ' 在 c#</string> - Cannot implicitly convert type 'string' to 'System.Threading.Tasks.Task<string>' in c# 无法将类型“Microsoft.AspNetCore.Mvc.NotFoundResult”隐式转换为“System.Threading.Tasks.Task” - Cannot implicitly convert type 'Microsoft.AspNetCore.Mvc.NotFoundResult' to 'System.Threading.Tasks.Task' 无法将类型&#39;bool&#39;隐式转换为&#39;system.threading.tasks.task bool&#39; - Cannot implicitly convert type 'bool' to 'system.threading.tasks.task bool' 无法隐式转换类型&#39;System.Threading.Tasks.Task <String> “串” - Cannot implicitly convert type 'System.Threading.Tasks.Task<String> to 'string'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM