.NET Framework 類別庫
AppDomain.GetCurrentThreadId 方法

請注意:這個方法現在已經過時。

取得目前的執行緒識別項。

命名空間: System
組件: mscorlib (在 mscorlib.dll 中)

語法

Visual Basic (宣告)
<ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread.  http://go.microsoft.com/fwlink/?linkid=14202", False)> _
Public Shared Function GetCurrentThreadId As Integer
Visual Basic (使用方式)
Dim returnValue As Integer

returnValue = AppDomain.GetCurrentThreadId
C#
[ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread.  http://go.microsoft.com/fwlink/?linkid=14202", false)] 
public static int GetCurrentThreadId ()
C++
[ObsoleteAttribute(L"AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread.  http://go.microsoft.com/fwlink/?linkid=14202", false)] 
public:
static int GetCurrentThreadId ()
J#
/** @attribute ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread.  http://go.microsoft.com/fwlink/?linkid=14202", false) */ 
public static int GetCurrentThreadId ()
JScript
ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread.  http://go.microsoft.com/fwlink/?linkid=14202", false) 
public static function GetCurrentThreadId () : int

傳回值

32 位元帶正負號的整數 (Signed Integer),其為目前執行緒的識別項。
.NET Framework 安全性

平台

Windows 98、 Windows 2000 SP4、 Windows Millennium Edition、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition

.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。

版本資訊

.NET Framework

支援版本:1.0、1.1
在 2.0 中已過時 (編譯器警告)
請參閱

標記 :


Page view tracker