Comment : définir un nom de thread dans le code managé
Mise à jour : novembre 2007
Cette rubrique s'applique à :
Édition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
||||
Standard |
||||
Pro et Team |
Légende du tableau :
Applicable |
|
Non applicable |
|
Commande ou commandes masquées par défaut. |
La propriété [System.Threading.Thread.Name] vous permet de définir un nom de thread dans le code managé.
Exemple
Public Class Needle
' This method will be called when the thread is started.
Sub Baz()
Console.WriteLine("Needle Baz is running on another thread")
End Sub
End Class
Sub Main()
Console.WriteLine("Thread Simple Sample")
Dim oNeedle As New Needle()
' Create a Thread object.
Dim oThread As New System.Threading.Thread(AddressOf oNeedle.Baz)
' Set the Thread name to "MainThread".
oThread.Name = "MainThread"
' Starting the thread invokes the ThreadStart delegate
oThread.Start()
End Sub
Voir aussi
Tâches
Comment : définir un nom de thread dans le code natif