SystemInfo CurrentThreadId Property | Apache log4net™ SDK Documentation

Gets the ID of the current thread.

Namespace: log4net.Util
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public static int CurrentThreadId { get; }

    Public Shared ReadOnly Property CurrentThreadId As Integer
    	Get

    public:
    static property int CurrentThreadId {
    	int get ();
    }

    static member CurrentThreadId : int with get

#### Property Value

Type: Int32
The ID of the current thread.
Remarks

On the .NET framework, the AppDomain.GetCurrentThreadId method is used to obtain the thread ID for the current thread. This is the operating system ID for the thread.

On the .NET Compact Framework 1.0 it is not possible to get the operating system thread ID for the current thread. The native method GetCurrentThreadId is implemented inline in a header file and cannot be called.

On the .NET Framework 2.0 the Thread.ManagedThreadId is used as this gives a stable id unrelated to the operating system thread ID which may change if the runtime is using fibers.

See Also

#### Reference

SystemInfo Class
log4net.Util Namespace