Thread.GetDomainID 메서드

정의

고유한 애플리케이션 도메인 식별자를 반환합니다.

public:
 static int GetDomainID();
public static int GetDomainID ();
static member GetDomainID : unit -> int
Public Shared Function GetDomainID () As Integer

반환

Int32

애플리케이션 도메인을 고유하게 식별하는 부호 있는 32비트 정수입니다.

예제

다음 코드 예제에서는 스레드가 실행 중인의 이름과 ID를 검색 하는 방법을 보여 줍니다 AppDomain .

using namespace System;
using namespace System::Threading;
ref class Test
{
private:
   Test(){}


public:
   static void ThreadMethod()
   {
      Console::WriteLine( "Thread {0} started in {1} with AppDomainID = {2}.", AppDomain::GetCurrentThreadId().ToString(), Thread::GetDomain()->FriendlyName, Thread::GetDomainID().ToString() );
   }

};

int main()
{
   Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::ThreadMethod ) );
   newThread->Start();
}
using System;
using System.Threading;

class Test
{
    static void Main()
    {
        Thread newThread = new Thread(new ThreadStart(ThreadMethod));
        newThread.Start();
    }

    static void ThreadMethod()
    {
        Console.WriteLine(
            "Thread {0} started in {1} with AppDomainID = {2}.",
            AppDomain.GetCurrentThreadId().ToString(), 
            Thread.GetDomain().FriendlyName, 
            Thread.GetDomainID().ToString());
    }
}
Imports System.Threading

Public Class Test

    <MTAThread> _
    Shared Sub Main()
        Dim newThread As New Thread(AddressOf ThreadMethod)
        newThread.Start()
    End Sub

    Shared Sub ThreadMethod()
        Console.WriteLine( _
            "Thread {0} started in {1} with AppDomainID = {2}.", _
            AppDomain.GetCurrentThreadId().ToString(), _
            Thread.GetDomain().FriendlyName, _
            Thread.GetDomainID().ToString())
    End Sub

End Class

적용 대상