WebThreadInformation.ThreadID Property

 

Gets the current thread identifier.

Namespace:   System.Web.Management
Assembly:  System.Web (in System.Web.dll)

public int ThreadID { get; }

Property Value

Type: System.Int32

The current thread identifier.

Even if managed threads might not have direct mapping to the OS threads, for debugging purposes, it is always useful to isolate a specific thread where problems might exist.

The following code example shows how to get the thread identifier.

// Get the task Id.
public string GetThreadId()
{
    // Get the request principal.
    return (string.Format(
        "Thread Id: {0}",
        ThreadInformation.ThreadID.ToString()));
}

.NET Framework
Available since 2.0
Return to top
Show: