Thread.GetDomainID Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

.NET Framework
Available since 1.1
Return to top
Show: