Export (0) Print
Expand All

Thread.GetDomainID Method

Returns a unique application domain identifier.

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

Public Shared Function GetDomainID As Integer

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.

Imports System
Imports System.Threading

Public Class Test

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

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

End Class

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft