I\'m going to use lots of tasks running on my application. Each bunch of tasks is running for some reason. I would like to name these tasks so when I watch the Parallel Tasks wi
public class NamedTaskSchedular
{
private static readonly ConcurrentDictionary NamedTaskDictionary = new ConcurrentDictionary();
public static Task RunNamedTask(string name, Action action)
{
if (NamedTaskDictionary.ContainsKey(name))
{
return NamedTaskDictionary[name].RunTask(action);
}
var task = new NamesTask();
NamedTaskDictionary[name] = task;
return task.RunTask(action);
}
}