We are leaving Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

How to find a scheduled job on displayname?

I have written the following code but what bothers me is that I have to use an index 1 for Args[1].

Doesn’t exist for this a named parameter? Or can I implement this in another way?

string jobName = $“My friendly unique job name”;
var scheduledJob = hangfireMonitor.ScheduledJobs(0, int.MaxValue).SingleOrDefault(o => o.Value.Job.Args[1].ToString() == jobName);
if (scheduledJob.Key != null)
{
BackgroundJob.Delete(scheduledJob.Key);
}

1 Like

I had a similar question and posted on StackOverflow here:
c# - Create a named scheduled job? - Stack Overflow