Share via


WebThreadInformation.ThreadID Propriedade

Definição

Obtém o identificador atual de thread.

public:
 property int ThreadID { int get(); };
public int ThreadID { get; }
member this.ThreadID : int
Public ReadOnly Property ThreadID As Integer

Valor da propriedade

Int32

O identificador de thread atual.

Exemplos

O exemplo de código a seguir mostra como obter o identificador de thread.

// Get the task Id.
public string GetThreadId()
{
    // Get the request principal.
    return (string.Format(
        "Thread Id: {0}",
        ThreadInformation.ThreadID.ToString()));
}
' Get the task Id.
Public Function GetThreadId() As String
   ' Get the request principal.
     Return String.Format( _
     "Thread Id: {0}", _
     ThreadInformation.ThreadID.ToString())
End Function 'GetThreadId

Comentários

Mesmo que os threads gerenciados não tenham mapeamento direto para os threads do sistema operacional, para fins de depuração, é sempre útil isolar um thread específico em que os problemas podem existir.

Aplica-se a