AppDomain.Id 속성

정의

프로세스 내 애플리케이션 도메인을 고유하게 식별하는 정수를 가져옵니다.

public:
 property int Id { int get(); };
public int Id { get; }
member this.Id : int
Public ReadOnly Property Id As Integer

속성 값

Int32

애플리케이션 도메인을 식별하는 정수입니다.

예제

다음 코드 예제에서는 두 번째 애플리케이션 도메인을 만들고 기본 도메인 및 새 도메인에 대 한 정보를 표시 합니다.

using namespace System;
using namespace System::Reflection;

// This method has the same signature as the CrossAppDomainDelegate,
// so that it can be executed easily in the new application domain.
//
static void ShowDomainInfo()
{
    AppDomain^ ad = AppDomain::CurrentDomain;
    Console::WriteLine();
    Console::WriteLine( L"FriendlyName: {0}", ad->FriendlyName );
    Console::WriteLine( L"Id: {0}", ad->Id );
    Console::WriteLine( L"IsDefaultAppDomain: {0}", ad->IsDefaultAppDomain() );
}

// The following attribute indicates to the loader that assemblies
// in the global assembly cache should be shared across multiple 
// application domains.
//
[LoaderOptimizationAttribute(LoaderOptimization::MultiDomainHost)]
int main()
{
    // Show information for the default application domain.
    ShowDomainInfo();

    // Create a new application domain and display its information.
    AppDomain^ newDomain = AppDomain::CreateDomain( L"MyMultiDomain" );
    newDomain->DoCallBack( gcnew CrossAppDomainDelegate( ShowDomainInfo ) );

    return 0;
}
using System;
using System.Reflection;

public class Example
{
    // The following attribute indicates to the loader that assemblies
    // in the global assembly cache should be shared across multiple
    // application domains.
    [LoaderOptimizationAttribute( LoaderOptimization.MultiDomainHost)]
    public static void Main()
    {
        // Show information for the default application domain.
        ShowDomainInfo();

        // Create a new application domain and display its information.
        AppDomain newDomain = AppDomain.CreateDomain("MyMultiDomain");
        newDomain.DoCallBack(new CrossAppDomainDelegate(ShowDomainInfo));
    }

    // This method has the same signature as the CrossAppDomainDelegate,
    // so that it can be executed easily in the new application domain.
    //
    public static void ShowDomainInfo()
    {
        AppDomain ad = AppDomain.CurrentDomain;
        Console.WriteLine();
        Console.WriteLine("FriendlyName: {0}", ad.FriendlyName);
        Console.WriteLine("Id: {0}", ad.Id);
        Console.WriteLine("IsDefaultAppDomain: {0}", ad.IsDefaultAppDomain());
    }
}
open System

// This method has the same signature as the CrossAppDomainDelegate,
// so that it can be executed easily in the new application domain.
let showDomainInfo () =
    let ad = AppDomain.CurrentDomain
    printfn $"\nFriendlyName: {ad.FriendlyName}"
    printfn $"Id: {ad.Id}"
    printfn $"IsDefaultAppDomain: {ad.IsDefaultAppDomain()}"

// The following attribute indicates to the loader that assemblies
// in the global assembly cache should be shared across multiple
// application domains.
[<LoaderOptimizationAttribute(LoaderOptimization.MultiDomainHost)>]
[<EntryPoint>]
let main _ =
    // Show information for the default application domain.
    showDomainInfo ()

    // Create a new application domain and display its information.
    let newDomain = AppDomain.CreateDomain "MyMultiDomain"
    newDomain.DoCallBack(CrossAppDomainDelegate showDomainInfo)
    0
Imports System.Reflection

Public Class Example
    
    ' The following attribute indicates to the loader that assemblies 
    ' in the global assembly cache should be shared across multiple
    ' application domains.
    <LoaderOptimizationAttribute(LoaderOptimization.MultiDomainHost)> _
    Public Shared Sub Main() 
        ' Show information for the default application domain.
        ShowDomainInfo()
        
        ' Create a new application domain and display its information.
        Dim newDomain As AppDomain = AppDomain.CreateDomain("MyMultiDomain")
        newDomain.DoCallBack(AddressOf ShowDomainInfo)
    
    End Sub
    
    
    ' This method has the same signature as the CrossAppDomainDelegate,
    ' so that it can be executed easily in the new application domain.
    ' 
    Public Shared Sub ShowDomainInfo() 
        Dim ad As AppDomain = AppDomain.CurrentDomain
        Console.WriteLine()
        Console.WriteLine("FriendlyName: {0}", ad.FriendlyName)
        Console.WriteLine("Id: {0}", ad.Id)
        Console.WriteLine("IsDefaultAppDomain: {0}", ad.IsDefaultAppDomain())
    
    End Sub 
End Class

적용 대상