using Elsa.Scheduling.Contracts; using Elsa.Scheduling.Models; using JetBrains.Annotations; namespace Elsa.Scheduling.Tasks; /// /// A generic task that executes the provided delegate. /// [PublicAPI] public class DelegateTask : ITask { private readonly Func _task; /// /// Initializes a new instance of the class. /// /// The delegate to execute. public DelegateTask(Func task) => _task = task; /// public ValueTask ExecuteAsync(TaskExecutionContext context) => _task(context); }