/// <summary> /// Cancel the task with the specified tag. /// <param name="tag"></param> /// </summary> public static ITaskQueue <TTaskInfo> Deschedule <TTaskInfo>(this ITaskQueue <TTaskInfo> source, string tag) where TTaskInfo : TaskInfo { var context = source.GetSchedulerContext(); var queue = context.Queue; var item = queue.FirstOrDefault(x => x.Tag == tag); if (item == null) { throw new InvalidOperationException($"Task with tag \"{tag}\" does not exist."); } return((ITaskQueue <TTaskInfo>)source.Deschedule(item)); }