|
Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte.
|
Traduction
Source
|
Convert.ToChar, méthode (Decimal)
.NET Framework 4
Assembly : mscorlib (dans mscorlib.dll)
Paramètres
- value
- Type : System.Decimal
Nombre décimal à convertir.
Valeur de retour
Type : System.Char| Exception | Condition |
|---|---|
| InvalidCastException |
public void ConvertCharDecimal(char charVal) { Decimal decimalVal = 0; // Char to decimal conversion is not supported and will always // throw an InvalidCastException. try { decimalVal = System.Convert.ToDecimal(charVal); } catch (System.InvalidCastException) { System.Console.WriteLine( "Char-to-Decimal conversion is not supported " + "by the .NET Framework."); } //Decimal to char conversion is also not supported. try { charVal = System.Convert.ToChar(decimalVal); } catch (System.InvalidCastException) { System.Console.WriteLine( "Decimal-to-Char conversion is not supported " + "by the .NET Framework."); } }
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
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.