Académique Documents
Professionnel Documents
Culture Documents
Introduction
Application domain (other name appDomain) is
nothing but one logical region where .NET
runtime runs and execute code.
Multiple application domains can exist in one
Win32 process.
It provides security and isolation for executing
managed code.
We can unload any task without affecting the
process.
The .NET runtime force application domain
isolation by keeping control over memory.
System.AppDomain
Class(1)
System.AppDomain
Class(2)
In
addition,
the
AppDomain class also
defines
as set of
properties that can be
useful when you wish
to monitor activity of a
given
application
domain
System;
System.Collections.Generic;
System.Linq;
System.Runtime.CompilerServices;
System.Text;
System.Threading;
System.Threading.Tasks;
System.Diagnostics;
System.Reflection;
namespace TestDomain
{
class Program
{
public static void Main(String[] args)
{
string callingDomainName = Thread.GetDomain().FriendlyName;
Console.WriteLine(callingDomainName);
//Get and display the full name of the EXE assembly.
string exeAssembly = Assembly.GetEntryAssembly().FullName;
Console.WriteLine(exeAssembly);
Console.ReadLine();
}
} }
System;
System.IO;
System.Linq;
ClassLibrary5;
namespace DemoTest
{
Console.WriteLine("Assemblies Loaded {0}\n",
class Program
ad.FriendlyName);
{
static void Main(string[] args)
foreach (var a in la)
{
{
AppDomain newDomain = AppDomain.CreateDomain("New
Console.WriteLine("Name:: {0}:",
AppDomain");
a.GetName().Name);
try
Console.WriteLine("Version:: {0}:\n",
{
a.GetName().Version);
newDomain.Load("ClassLibrary5");
}
}
}
catch (FileNotFoundException)
}
{
}
Console.WriteLine("Not Found");
}
ListAssemblies(newDomain);
Console.ReadKey();
}