public Task Submit(ITaskExecutor executor) { if (_task.Action == null) { throw new InvalidOperationException("Cannot submit a task with null action."); } _task.NextExecution = DateTime.Now.AddMilliseconds(_task.Delay); _task.IsAlive = true; executor.Enqueue(_task); return(_task); }