|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
ThreadStateException, classe
Espace de noms : System.Threading
Assembly : mscorlib (dans mscorlib.dll)
Le type ThreadStateException expose les membres suivants.
| Nom | Description | |
|---|---|---|
![]() ![]() | ThreadStateException() | |
![]() ![]() | ThreadStateException(String) | |
![]() | ThreadStateException(SerializationInfo, StreamingContext) | |
![]() ![]() | ThreadStateException(String, Exception) |
| Nom | Description | |
|---|---|---|
![]() | Data | |
![]() | HelpLink | |
![]() ![]() | HResult | |
![]() ![]() | InnerException | |
![]() ![]() | Message | |
![]() | Source | |
![]() ![]() | StackTrace | |
![]() | TargetSite |
| Nom | Description | |
|---|---|---|
![]() ![]() | Equals(Object) | |
![]() ![]() | Finalize | |
![]() ![]() | GetBaseException | |
![]() ![]() | GetHashCode | |
![]() | GetObjectData | |
![]() ![]() | GetType | Dans XNA Framework 3.0, ce membre est hérité de Object.GetType(). |
![]() ![]() | MemberwiseClone | |
![]() ![]() | ToString |
| Nom | Description | |
|---|---|---|
![]() | SerializeObjectState |
using System; using System.Threading; public class ThreadWork { public static void DoWork() { Console.WriteLine("Working thread..."); } } class ThreadStateTest { public static void Main() { ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myThreadDelegate); myThread.Start(); Thread.Sleep(0); Console.WriteLine("In main. Attempting to restart myThread."); try { myThread.Start(); } catch(ThreadStateException e) { Console.WriteLine("Caught: {0}", e.Message); } } }
In main. Attempting to restart myThread.
Working thread...
Caught: Thread is running or terminated. Cannot restart.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

