本文整理匯總了C#中System.AppDomain.BaseDirectory屬性的典型用法代碼示例。如果您正苦於以下問題:C# AppDomain.BaseDirectory屬性的具體用法?C# AppDomain.BaseDirectory怎麽用?C# AppDomain.BaseDirectory使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.AppDomain
的用法示例。
在下文中一共展示了AppDomain.BaseDirectory屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.IO;
using System.Reflection;
using System.Security.Policy;
class ADSetup
{
public static void Main()
{
// Create application domain setup information
var domaininfo = new AppDomainSetup();
domaininfo.ConfigurationFile = System.Environment.CurrentDirectory +
Path.DirectorySeparatorChar +
"ADSetup.exe.config";
domaininfo.ApplicationBase = System.Environment.CurrentDirectory;
//Create evidence for the new appdomain from evidence of the current application domain
Evidence adEvidence = AppDomain.CurrentDomain.Evidence;
// Create appdomain
AppDomain domain = AppDomain.CreateDomain("Domain2", adEvidence, domaininfo);
// Display application domain information.
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("Child domain: " + domain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Configuration file: " + domain.SetupInformation.ConfigurationFile);
Console.WriteLine("Application Base Directory: " + domain.BaseDirectory);
AppDomain.Unload(domain);
}
}
輸出:
Host domain: adsetup.exe Child domain: Domain2 Configuration file: C:\Test\ADSetup.exe.config Application Base Directory: C:\Test