/// <summary>
        /// Executes the specified <see cref="Action"/> in the specified Domain.
        /// </summary>
        /// <param name="disposableAppDomain">The Domain within which to execute the specified action.</param>
        /// <param name="action">The action to execute.</param>
        public static void Execute(
            this DisposableAppDomain disposableAppDomain,
            Action action)
        {
            if (disposableAppDomain == null)
            {
                throw new ArgumentNullException(nameof(disposableAppDomain));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            var domainDelegate = disposableAppDomain.BuildAppDomainDelegate();

            domainDelegate.Execute(action);
        }
        /// <summary>
        /// Executes the specified <see cref="Func{TResult}"/> in the specified Domain.
        /// </summary>
        /// <typeparam name="TResult">The type of the return value of the method that <paramref name="func"/> encapsulates.</typeparam>
        /// <param name="disposableAppDomain">The Domain within which to execute the specified func.</param>
        /// <param name="func">The func to execute.</param>
        /// <returns>
        /// The return value from executing the specified <see cref="Func{TResult}"/> in the specified Domain.
        /// </returns>
        public static TResult Execute <TResult>(
            this DisposableAppDomain disposableAppDomain,
            Func <TResult> func)
        {
            if (disposableAppDomain == null)
            {
                throw new ArgumentNullException(nameof(disposableAppDomain));
            }

            if (func == null)
            {
                throw new ArgumentNullException(nameof(func));
            }

            var domainDelegate = disposableAppDomain.BuildAppDomainDelegate();

            var result = domainDelegate.Execute(func);

            return(result);
        }