AppDomain.CurrentDomain 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 Thread에 대한 현재 애플리케이션 도메인을 가져옵니다.
public:
static property AppDomain ^ CurrentDomain { AppDomain ^ get(); };
public static AppDomain CurrentDomain { get; }
member this.CurrentDomain : AppDomain
Public Shared ReadOnly Property CurrentDomain As AppDomain
속성 값
현재 애플리케이션 도메인입니다.
예제
다음 코드 예제에서는 새 애플리케이션 도메인을 만듭니다. 합니다 CurrentDomain 속성은 가져오는 데는 AppDomain 현재 애플리케이션 도메인을 나타내는 개체입니다. FriendlyName 속성은 명령줄에서 다음 표시 되는 현재 애플리케이션 도메인의 이름을 제공 합니다.
using namespace System;
int main()
{
AppDomain^ root = AppDomain::CurrentDomain;
AppDomainSetup^ setup = gcnew AppDomainSetup();
setup->ApplicationBase =
root->SetupInformation->ApplicationBase + "MyAppSubfolder\\";
AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup);
Console::WriteLine("Application base of {0}:\r\n\t{1}",
root->FriendlyName, root->SetupInformation->ApplicationBase);
Console::WriteLine("Application base of {0}:\r\n\t{1}",
domain->FriendlyName, domain->SetupInformation->ApplicationBase);
AppDomain::Unload(domain);
}
/* This example produces output similar to the following:
Application base of MyApp.exe:
C:\Program Files\MyApp\
Application base of MyDomain:
C:\Program Files\MyApp\MyAppSubfolder\
*/
using System;
class ADSetupInformation
{
static void Main()
{
AppDomain root = AppDomain.CurrentDomain;
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase =
root.SetupInformation.ApplicationBase + @"MyAppSubfolder\";
AppDomain domain = AppDomain.CreateDomain("MyDomain", null, setup);
Console.WriteLine("Application base of {0}:\r\n\t{1}",
root.FriendlyName, root.SetupInformation.ApplicationBase);
Console.WriteLine("Application base of {0}:\r\n\t{1}",
domain.FriendlyName, domain.SetupInformation.ApplicationBase);
AppDomain.Unload(domain);
}
}
/* This example produces output similar to the following:
Application base of MyApp.exe:
C:\Program Files\MyApp\
Application base of MyDomain:
C:\Program Files\MyApp\MyAppSubfolder\
*/
open System
let root = AppDomain.CurrentDomain
let setup = AppDomainSetup()
setup.ApplicationBase <-
root.SetupInformation.ApplicationBase + @"MyAppSubfolder\"
let domain = AppDomain.CreateDomain("MyDomain", null, setup)
printfn $"Application base of {root.FriendlyName}:\r\n\t{root.SetupInformation.ApplicationBase}"
printfn $"Application base of {domain.FriendlyName}:\r\n\t{domain.SetupInformation.ApplicationBase}"
AppDomain.Unload domain
(* This example produces output similar to the following:
Application base of MyApp.exe:
C:\Program Files\MyApp\
Application base of MyDomain:
C:\Program Files\MyApp\MyAppSubfolder\
*)
Class ADSetupInformation
Shared Sub Main()
Dim root As AppDomain = AppDomain.CurrentDomain
Dim setup As New AppDomainSetup()
setup.ApplicationBase = _
root.SetupInformation.ApplicationBase & "MyAppSubfolder\"
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", Nothing, setup)
Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
root.FriendlyName, root.SetupInformation.ApplicationBase)
Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
domain.FriendlyName, domain.SetupInformation.ApplicationBase)
AppDomain.Unload(domain)
End Sub
End Class
' This example produces output similar to the following:
'
'Application base of MyApp.exe:
' C:\Program Files\MyApp\
'Application base of MyDomain:
' C:\Program Files\MyApp\MyAppSubfolder\