Thread::GetDomainID Method ()

 

Returns a unique application domain identifier.

Namespace:   System.Threading
Assembly:  mscorlib (in mscorlib.dll)

public:
static int GetDomainID()

Return Value

Type: System::Int32

A 32-bit signed integer uniquely identifying the application domain.

The following code example shows how to retrieve the name and ID of the AppDomain in which the thread is running.

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();
}

.NET Framework
Available since 1.1
Return to top
Show: