Thread::GetDomain Method ()
.NET Framework (current version)
Returns the current domain in which the current thread is running.
Assembly: mscorlib (in mscorlib.dll)
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
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: