IScheduler 接口提供
public static IDisposable Schedule(this IScheduler scheduler, Action action)
和
public static IDisposable ScheduleAsync(this IScheduler scheduler, Func<IScheduler, CancellationToken, System.Threading.Tasks.Task<IDisposable>> action)
ScheduleAsync 的方法说明:
// Summary:
// Schedules work using an asynchronous method, allowing for cooperative scheduling
// in an imperative coding style.
//
// Parameters:
// scheduler:
// Scheduler to schedule work on.
//
// action:
// Asynchronous method to run the work, using Yield and Sleep operations for
// cooperative scheduling and injection of cancellation points.
//
// Returns:
// Disposable object that allows to cancel outstanding work on cooperative cancellation
// points or through the cancellation token passed to the asynchronous method.
//
// Exceptions:
// System.ArgumentNullException:
// scheduler or action is null.
有人可以解释这两种方法之间的区别吗?
我什么时候应该使用 ScheduleAsync?
我什么时候应该使用时间表?
允许以命令式编码风格进行协作调度意味着什么?
谢谢。