.NET应用程序域
.NET可执行程序承载在进程的一个逻辑分区中,属于称为“应用程序域(AppDomain)”。
一个进程可以承载多个应用程序域,每个应用程序域承载一个.NET可执行程序。
列举当前应用程序域中的程序集
代码
class Program
{
/// <summary>
///
/// Print All Assemblies In AppDomain
/// from <pro c#>
/// modified by fred song
/// 2010.7.11
///
/// </summary>
/// <param name="ad"></param>
public static void PrintAllAssembliesInAppDomain(AppDomain ad)
{
Assembly[] loadedAssemblies = ad.GetAssemblies();
Console.WriteLine("*****Here are the assemblies loaded in {0} ********"
, ad.FriendlyName);
foreach (Assembly a in loadedAssemblies)
{
Console.WriteLine("->Name:{0}", a.GetName().Name);
Console.WriteLine("->Version:{0}", a.GetName().Version);
}
}
static void Main(string[] args)
{
Console.WriteLine("*******Test AppDomain********");
AppDomain defaultAD = AppDomain.CurrentDomain;
MessageBox.Show("hello world");
PrintAllAssembliesInAppDomain(defaultAD);
Console.ReadLine();
}
{
/// <summary>
///
/// Print All Assemblies In AppDomain
/// from <pro c#>
/// modified by fred song
/// 2010.7.11
///
/// </summary>
/// <param name="ad"></param>
public static void PrintAllAssembliesInAppDomain(AppDomain ad)
{
Assembly[] loadedAssemblies = ad.GetAssemblies();
Console.WriteLine("*****Here are the assemblies loaded in {0} ********"
, ad.FriendlyName);
foreach (Assembly a in loadedAssemblies)
{
Console.WriteLine("->Name:{0}", a.GetName().Name);
Console.WriteLine("->Version:{0}", a.GetName().Version);
}
}
static void Main(string[] args)
{
Console.WriteLine("*******Test AppDomain********");
AppDomain defaultAD = AppDomain.CurrentDomain;
MessageBox.Show("hello world");
PrintAllAssembliesInAppDomain(defaultAD);
Console.ReadLine();
}
-------------------------------------------------
!!!作者:木由水 http://www.cnblogs.com/muyoushui