|
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
|
Convert.ToInt16, méthode (UInt32)
.NET Framework 4.5
Cette API n'est pas conforme CLS. Espace de noms : System
Assembly : mscorlib (dans mscorlib.dll)
Paramètres
- value
- Type : System.UInt32
Entier non signé 32 bits à convertir.
| Exception | Condition |
|---|---|
| OverflowException |
uint[] numbers = { UInt32.MinValue, 121, 340, UInt32.MaxValue }; short result; foreach (uint number in numbers) { try { result = Convert.ToInt16(number); Console.WriteLine("Converted the {0} value {1} to a {2} value {3}.", number.GetType().Name, number, result.GetType().Name, result); } catch (OverflowException) { Console.WriteLine("The {0} value {1} is outside the range of the Int16 type.", number.GetType().Name, number); } } // The example displays the following output: // Converted the UInt32 value 0 to a Int16 value 0. // Converted the UInt32 value 121 to a Int16 value 121. // Converted the UInt32 value 340 to a Int16 value 340. // The UInt32 value 4294967295 is outside the range of the Int16 type.
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.