|
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.ToUInt64, méthode (Decimal)
.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.Decimal
Nombre décimal à convertir.
Valeur de retour
Type : System.UInt64| Exception | Condition |
|---|---|
| OverflowException |
decimal[] values= { Decimal.MinValue, -1034.23m, -12m, 0m, 147m, 199.55m, 9214.16m, Decimal.MaxValue }; ulong result; foreach (decimal value in values) { try { result = Convert.ToUInt64(value); Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", value.GetType().Name, value, result.GetType().Name, result); } catch (OverflowException) { Console.WriteLine("{0} is outside the range of the UInt64 type.", value); } } // The example displays the following output: // -79228162514264337593543950335 is outside the range of the UInt64 type. // -1034.23 is outside the range of the UInt64 type. // -12 is outside the range of the UInt64 type. // Converted the Decimal value '0' to the UInt64 value 0. // Converted the Decimal value '147' to the UInt64 value 147. // Converted the Decimal value '199.55' to the UInt64 value 200. // Converted the Decimal value '9214.16' to the UInt64 value 9214. // 79228162514264337593543950335 is outside the range of the UInt64 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.