/// <summary>
    /// Run an async task. This method will block execution (and use the calling thread as a worker thread) until the async task has completed.
    /// </summary>
    public static void Run(Func <Task> main, int degreeOfParallelism = 1)
    {
        var asyncOperatingContext = new AsyncOperatingContext();

        asyncOperatingContext.DegreeOfParallelism = degreeOfParallelism;
        asyncOperatingContext.RunMain(main);
    }
    /// <summary>
    /// Run an async task. This method will block execution (and use the calling thread as a worker thread) until the async task has completed.
    /// </summary>
    public static T Run <T>(Func <Task <T> > main, int degreeOfParallelism = 1)
    {
        var asyncOperatingContext = new AsyncOperatingContext();

        asyncOperatingContext.DegreeOfParallelism = degreeOfParallelism;
        return(asyncOperatingContext.RunMain(main));
    }