|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Método Convert.ToUInt64 (Decimal)
.NET Framework 4.5
Esta API não compatível com CLS. Namespace: System
Assembly: mscorlib (em mscorlib.dll)
Parâmetros
- value
- Tipo: System.Decimal
O número decimal a conversão.
Valor de retorno
Tipo: System.UInt64| Exceção | Condição |
|---|---|
| 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 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.