System.AppDomain.ExecuteAssemblyByName C# (CSharp) Method

ExecuteAssemblyByName() public method

public ExecuteAssemblyByName ( string assemblyName ) : int
assemblyName string
return int
        public int ExecuteAssemblyByName(string assemblyName) =>
            ExecuteAssemblyByName(assemblyName, null);

Same methods

AppDomain::ExecuteAssemblyByName ( AssemblyName assemblyName ) : int

Usage Example

示例#1
0
        private static System.AppDomain CreateAndRunAppDomain(int index, PermissionSet grantSet)
        {
            // Construct and initialize settings for a second AppDomain.
            AppDomainSetup ads = new AppDomainSetup();

            ads.ApplicationBase = System.AppDomain.CurrentDomain.BaseDirectory;

            ads.DisallowBindingRedirects = false;
            ads.DisallowCodeDownload     = true;
            ads.ConfigurationFile        =
                System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string name = "AppDomain" + index;

            System.AppDomain appDomain1 = System.AppDomain.CreateDomain(
                name,
                System.AppDomain.CurrentDomain.Evidence,
                ads,
                grantSet);

            var argsToPass = new string[] { name, index.ToString(), "SqlServer" };

            appDomain1.ExecuteAssemblyByName(
                typeof(AppDomainInstanceProgram).Assembly.FullName,
                argsToPass);

            Console.WriteLine("**********************************************");
            Console.WriteLine($"Finished executing in AppDomain {name}");
            Console.WriteLine("**********************************************");
            return(appDomain1);
        }
All Usage Examples Of System.AppDomain::ExecuteAssemblyByName